Skip to content

fix: reject non-canonical ASN.1 INTEGER encodings#52

Open
leopoldjoy wants to merge 1 commit into
mainfrom
security/canonical-cert-integers
Open

fix: reject non-canonical ASN.1 INTEGER encodings#52
leopoldjoy wants to merge 1 commit into
mainfrom
security/canonical-cert-integers

Conversation

@leopoldjoy

Copy link
Copy Markdown
Contributor

Summary

  • centralize positive INTEGER parsing for uintAt and uint384At
  • reject empty INTEGERs, unnecessary leading zeroes, negative values, and overlong values after sign-byte stripping
  • preserve required DER sign padding and short P-384 scalar handling

Security value

This removes alternate encodings of the same ECDSA r/s or ASN.1 integer value, reducing certificate byte malleability and parser disagreement with DER-strict tooling.

Tests

  • forge fmt --check src test
  • forge test --match-contract 'Asn1DecodeTest|CertManagerTest' -vvv

Note

Latest main already fails test_DeployableContractsFitEIP170 locally with CertManager runtime bytes 24,708 > 24,576, so full-suite verification remains blocked by that pre-existing size issue.

Co-authored-by: OpenCode <opencode-noreply@coinbase.com>
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