Skip to content

feat: bind EIP-712 signed invites to recipient address#148

Open
Tranquil-Flow wants to merge 2 commits into
devfrom
feat/address-bound-invites
Open

feat: bind EIP-712 signed invites to recipient address#148
Tranquil-Flow wants to merge 2 commits into
devfrom
feat/address-bound-invites

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

Closes #77

Signed invites were not address-bound — anyone who obtained a valid signed invite could redeem it. This adds the intended recipient address to the EIP-712 typehash and verifies msg.sender matches at redemption time.

Breaking change: The Invite EIP-712 typehash changes from Invite(uint256 id,uint256 nonce) to Invite(uint256 id,uint256 nonce,address recipient). Any previously signed invites will be invalidated.

Changes

  • _INVITE_TYPEHASH: updated to include address recipient
  • _hashInvite(): accepts _recipient parameter, encodes it in the struct hash
  • redeemInvite(): passes msg.sender as recipient — signature recovery fails if sender doesn't match
  • New tests: test_RedeemInviteRejectsWrongSender, test_RedeemInviteAcceptsCorrectRecipient
  • All existing invite tests updated with recipient parameter

Test plan

  • forge test passes (142 tests)
  • Wrong-sender test confirms invite signed for alice is rejected when redeemed by stranger
  • Correct-recipient test confirms alice can redeem her own invite

Update the EIP-712 invite typehash to include the recipient address,
preventing any holder of a valid signed invite from redeeming it unless
they are the intended recipient. The owner controls invite issuance;
address-binding adds defence-in-depth with no protocol downside.

- Update _INVITE_TYPEHASH to include recipient address
- Update redeemInvite() to verify msg.sender matches the bound address
- Add regression tests for both valid redemption and rejection of wrong sender
- Add TASKS.md as project tracking file
- Closes: #77
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.

redeemtInvite() potential abuse

1 participant