Skip to content

fix: validate transaction calls before co-signing as fee payer#64

Closed
brendanjryan wants to merge 2 commits intofeat/full-fee-payer-supportfrom
feat/cosign-validation
Closed

fix: validate transaction calls before co-signing as fee payer#64
brendanjryan wants to merge 2 commits intofeat/full-fee-payer-supportfrom
feat/cosign-validation

Conversation

@brendanjryan
Copy link
Collaborator

Stacked on #62.

Problem

_cosign_as_fee_payer() would co-sign any valid 0x76 transaction without verifying the call target, selector, amount, or recipient. An attacker could submit a sender-signed tx targeting any contract and the server would sponsor it.

Changes

Security fix

  • Add _validate_cosign_calls() that checks decoded transaction calls match the charge request (currency, recipient, amount, selector, memo) before the server co-signs
  • Pass the ChargeRequest through to _cosign_as_fee_payer()

Cleanup

  • Move import attrs to top-level in both client.py and intents.py (hard dependency, was imported inline)

Tests (11 new)

  • TestCosignAsFeePayer: roundtrip co-signing, wrong tx type rejection, malformed hex rejection, no fee payer configured, wrong currency/amount/recipient rejection, matching request acceptance
  • TestFeePayerPropagation: fee_payer propagation via _method backlink, default None, standalone None

brendanjryan and others added 2 commits February 18, 2026 20:32
- Add _validate_cosign_calls() to reject transactions that don't match
  the charge request (currency, recipient, amount, selector) before
  the server co-signs them. Prevents the fee payer from being used as
  an open gas relay.
- Move attrs import to top-level in client.py and intents.py (hard dep).
- Add 11 tests: cosign roundtrip, malformed input rejection, call
  validation (wrong currency/amount/recipient), and fee_payer
  propagation through tempo() factory.
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