Skip to content

Enforce canonical base64url decoding - #408

Merged
rjeffman merged 1 commit into
latchset:mainfrom
simo5:fix407
Nov 16, 2026
Merged

rjeffman merged 1 commit into
latchset:mainfrom
simo5:fix407

Conversation

@simo5

@simo5 simo5 commented Nov 16, 2026

Copy link
Copy Markdown
Member

Require base64url_decode to reject non-canonical inputs by checking that re-encoding the decoded payload matches the original string.

This prevents accepting inputs with non-zero padding bits, unstripped '=' padding, or non-URL-safe characters, ensuring strict compliance with cryptographic test suites such as Project Wycheproof.
Fixes #407

Require base64url_decode to reject non-canonical inputs
by checking that re-encoding the decoded payload matches
the original string.

This prevents accepting inputs with non-zero padding bits,
unstripped '=' padding, or non-URL-safe characters,
ensuring strict compliance with cryptographic test suites
such as Project Wycheproof.

Assisted-by: Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@detuned.org>
@simo5
simo5 requested a review from rjeffman November 16, 2026 18:44

@rjeffman rjeffman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@rjeffman
rjeffman merged commit befc11f into latchset:main Nov 16, 2026
16 checks passed
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.

JWS verify accepts a payload segment with non-zero unused base64url bits

2 participants