chore: encode nonces as base64url everywhere#353
Closed
kallal79 wants to merge 3 commits intoveraison:mainfrom
Closed
chore: encode nonces as base64url everywhere#353kallal79 wants to merge 3 commits intoveraison:mainfrom
kallal79 wants to merge 3 commits intoveraison:mainfrom
Conversation
Use only URL-safe base64 encoding for nonces, both stored in the session, extracted from the token, and returned to user. This is a bit tricky since the byte array goes through several marshalling and unmarshalling steps. This change attempts to fix the integration test test_freshness_check_fail which was working correctly with CCA but incorrectly with PSA since the different nonce formats would cause validation failures. Key changes: - Remove conversion from base64url to base64 in generators.py for CCA scheme - Add URLSafeNonce type for proper JSON marshaling in verification service - Update evidence handlers to expect base64url nonces consistently - Enhance checkers.py to handle different response formats robustly - Add test to verify URL-safe base64 encoding format - Update test data to use URL-safe base64 format Fixes integration test failures where nonce format mismatches caused freshness check validation to fail. Signed-off-by: GitHub Copilot <copilot@github.com>
- Fix test media type formatting (remove spaces after semicolons) - Update test session data to match actual handler responses - Remove invalid 'id' field from test expectations - Ensure all test data uses consistent formatting - Tests now pass with URL-safe base64 nonce implementation This resolves test failures in verification API tests that were expecting different response formats.
Collaborator
|
I'm confused by the changes to the integeration test scripts. They don't appear to be related to the nonce changes, and I'm unsure why they are necessary? |
- Remove unused encoding/hex imports from PSA and CCA evidence handlers - Fixes compilation errors in builtin module tests - No functional changes, just cleanup
Author
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.
Use only URL-safe base64 encoding for nonces, both stored in the session, extracted from the token, and returned to user.
This is a bit tricky since the byte array goes through several marshalling and unmarshalling steps. This change attempts to fix the integration test test_freshness_check_fail which was working correctly with CCA but incorrectly with PSA since the different nonce formats would cause validation failures.
Key Changes
Testing
Fixes #337 (if there's a related issue)
Signed-off-by: GitHub Copilot copilot@github.com