Skip to content

fix(evm-charge): remove redundant externalId from Permit2 witness - #313

Closed
chopmob-cloud wants to merge 1 commit into
tempoxyz:mainfrom
chopmob-cloud:fix/evm-charge-witness-externalId
Closed

fix(evm-charge): remove redundant externalId from Permit2 witness#313
chopmob-cloud wants to merge 1 commit into
tempoxyz:mainfrom
chopmob-cloud:fix/evm-charge-witness-externalId

Conversation

@chopmob-cloud

Copy link
Copy Markdown

Closes #287.

@Xeift is right: externalId in the Permit2 PaymentWitness is redundant.

The witness commits to challengeHash = keccak256(challenge.id, challenge.realm), and challenge.id is an HMAC whose slot 3 is the entire request object, JCS-serialized per RFC 8785 (core draft-httpauth-payment-00). Since externalId is a member of request, it is already bound to challenge.id (and therefore to challengeHash and the signature) whenever present. The separate witness field binds nothing new.

Removing it is also a small hardening: the old text carried a PaymentWitness.externalId == "" absent-case rule that duplicated, at the witness layer, the absent-optional-field convention the core spec already resolves deterministically at HMAC slot 3 via JCS. Two separately-specified conventions for the same thing is a needless cross-implementation divergence risk.

No regression to the type="hash" mitigation ("Requiring unique externalId values per challenge") — that operates at the challenge.id layer, not the witness, so distinct externalId still yields distinct challengeHash.

Changes (one file):

  • Drop string externalId; from the PaymentWitness struct and from the EIP-712 witness type string.
  • Reword the Witness Data section to state binding flows through challengeHash -> challenge.id (which already commits to every request field, incl. externalId).
  • Update the type="permit2" bullet accordingly.

externalId intentionally remains as the request field, the receipt echo, and the hash-mode mitigation.

Validation: builds clean through kramdown-rfc + xml2rfc (HTML/TXT); rfclint --no-rng --no-spell exit 0; lint_frontmatter.py clean. DCO signed-off.

…mpoxyz#287)

challengeHash already commits to challenge.id, whose HMAC serializes the
full request object (JCS/RFC 8785) including externalId. The separate
witness field binds nothing new and forced an empty-string special case
duplicating the core spec s absent-optional-field handling. Removal
preserves binding and drops a cross-implementation encoding divergence;
the type=hash unique-externalId mitigation is unaffected (challenge.id
layer, not the witness).

Signed-off-by: AlgoVoi <chopmob@gmail.com>
@brendanjryan

Copy link
Copy Markdown
Collaborator

even if redundant, changing this interface would be breaking. I'm preferential to not do this in the short term

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.

EVM Charge: Remove externalId in Permit2 Payment Witness Struct

2 participants