feat: support unsecured JWTs (alg: none, RFC 7519 s6.1)#459
Open
kimjune01 wants to merge 2 commits into
Open
Conversation
…ke-engel#253) Encode with --alg none (no --secret required): jwt encode --alg none -P role=my-role Decode unsecured JWTs (alg: "none" in header): jwt decode eyJhbGciOiJub25lIn0.eyJpc3MiOiJqb2UifQ. Bypasses jsonwebtoken library for the none case since it does not support alg: none. Encoding produces header.payload. (empty sig). Decoding parses base64url parts directly.
The jsonwebtoken::Header struct cannot represent alg: "none", so decode_unsecured_token was using HS256 as a placeholder. This caused decoded unsecured JWTs to display "alg": "HS256" instead of "alg": "none". Fix by preserving the raw header JSON from unsecured tokens and using it for display in print_decoded_token. Normal signed JWTs are unaffected.
|
Supporting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
alg: none) per RFC 7519 Section 6.1--algorithm noneflag to produce unsecured tokens with empty signaturealgheader value for unsecured JWTsFixes #253
Test plan
Failing tests before / Passing tests after / How the tests ran
Sweep attestation
e89918ea4a89— see the receipts footer below.