Skip to content

Fix paid /claim attestation binding contract - #42

Open
azender1 wants to merge 3 commits into
mainfrom
fix/paid-claim-attestation-binding
Open

azender1 wants to merge 3 commits into
mainfrom
fix/paid-claim-attestation-binding

Conversation

@azender1

@azender1 azender1 commented Oct 1, 2026

Copy link
Copy Markdown
Owner

This PR fixes the older paid /claim attestation-binding bug separately from PR #41.

Problem:

  • attestation_gate.gate() expects a binding preimage shaped as {amount_usd, charge_ref, nonce, subject_did}
  • paid /claim was instead passing {agent_id, action_type, scope, timestamp:""}
  • any real attestation carrying a binding digest could therefore never match that claim input

Fix:

  • add optional attestation_binding to the paid /claim request schema
  • pass those exact four binding fields to the attestation gate
  • optional attestation mode: if binding material is absent, explicitly SKIP with claim_binding_missing
  • required attestation mode: if binding material is absent, DENY before creating a claim
  • do not derive these fields from the x402 access payment because that payment is SafeAgent's service fee, not the guarded real-world charge/action

Backwards compatibility:

  • existing callers are unchanged when attestation checking is disabled
  • attestation_binding is optional
  • /claim/test is untouched

Tests cover optional missing binding, required missing binding, and exact binding propagation to the gate.

This branch has not been deployed

No deployments
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.

1 participant