Skip to content

fix(comms): use /attestation/check to validate chat sender#723

Merged
rickyrombo merged 1 commit intomainfrom
mjp-fix-chat-aao-check
Mar 17, 2026
Merged

fix(comms): use /attestation/check to validate chat sender#723
rickyrombo merged 1 commit intomainfrom
mjp-fix-chat-aao-check

Conversation

@rickyrombo
Copy link
Contributor

Summary

  • Replace the dummy POST /attestation/{handle} challenge with GET /attestation/check?wallet= for the chat create abuse check
  • The /attestation/:handle endpoint now validates challengeId server-side, so sending "x" returns non-2xx and incorrectly blocks all users from creating new chats
  • The dedicated /attestation/check endpoint accepts a wallet address and returns 200 (allowed) or 400 (blocked) without needing a real challenge ID

Test plan

  • Create a new chat as a normal user — should succeed (no longer 403)
  • Verify a blocked/abusive user still gets 403 when trying to create a chat

🤖 Generated with Claude Code

The POST /attestation/{handle} endpoint validates challengeId, so sending
a dummy "x" challenge now returns non-2xx and incorrectly blocks all users
from creating chats. Switch to the dedicated GET /attestation/check?wallet=
endpoint which scores users without requiring a real challenge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the comms anti-abuse-oracle (AAO) attestation validation to query by a user’s wallet address instead of handle, aligning chat abuse checks with wallet-based identity.

Changes:

  • Switch AAO attestation check from a POST to /attestation/{handle} to a GET against /attestation/check?wallet=....
  • Change DB lookup used for AAO check from users.handle to users.wallet.
  • Remove the now-unused bytes import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +527 to 533
var wallet string
err := pool.QueryRow(ctx, `SELECT wallet FROM users WHERE user_id = $1`, userId).Scan(&wallet)
if err != nil {
if err == pgx.ErrNoRows {
return fmt.Errorf("user %d not found", userId)
}
return err
Comment on lines +536 to +537
url := fmt.Sprintf("%s/attestation/check?wallet=%s", aaoServer, wallet)
resp, err := http.Get(url)
Comment on lines +537 to 538
resp, err := http.Get(url)
if err != nil {
@rickyrombo rickyrombo merged commit 5659120 into main Mar 17, 2026
9 checks passed
@rickyrombo rickyrombo deleted the mjp-fix-chat-aao-check branch March 17, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants