-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(jans-cedarling): add tests and fix bugs caught in testing #9999
base: main
Are you sure you want to change the base?
Conversation
…able types - replace token structs in test utils with generic serializable types for greater test flexibility Signed-off-by: rmarinn <[email protected]>
- Implement tests to verify error handling when required claims are missing (iss, aud, sub, iat, exp). - Add test for when the access_token has an invalid signature. Signed-off-by: rmarinn <[email protected]>
- Implement tests to verify error handling when required claims are missing (iss, aud, sub, iat, exp). - Add test for when the id_token has an invalid signature. - Add test for when the id_token has a different iss with access_token. - Add test for when the id_token has a different aud with access_token. - Add test for when the id_token is expired. Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- Implement tests to verify error handling when required claims are missing (iss, aud, sub, iat, exp). - Add test for when the userinfo_token has an invalid signature. - Add test for when the userinfo_token has a different iss with the access_token. - Add test for when the userinfo_token has a different aud with the access_token. - Add test for when the userinfo_token has a different sub with the id_token. Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- fixed a bug where the validation for the `aud` and `iss` of the userinfo_token is mixed up Signed-off-by: rmarinn <[email protected]>
…ecodingArgs` - This change consolidates the parameters for the `decode` function into a single `DecodingArgs` struct, for easier code readability and maintainability. Signed-off-by: rmarinn <[email protected]>
…validation Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
… variant - renamed decoding_strategy::Error::JwkMissingKid to decoding_strategy::Error::JwtMissingKeyId Signed-off-by: rmarinn <[email protected]>
- add test expecting to error when using access_token before nbf - add test expecting to error when using id_token before nbf - add test expecting to error when using userinfo_token nbf Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
DryRun Security SummaryThe pull request focuses on improving the security and reliability of the JWT (JSON Web Token) handling functionality in the Cedarling application, with changes spanning several files and covering various aspects of JWT decoding, validation, and error handling. Expand for full summarySummary: The code changes in this pull request focus on improving the security and reliability of the JWT (JSON Web Token) handling functionality in the Cedarling application. The changes span several files and cover various aspects of JWT decoding, validation, and error handling. Key security-related improvements include:
Overall, the changes in this pull request show a strong focus on improving the security and robustness of the JWT handling functionality in the Cedarling application, which is a critical component for securing the application's authentication and authorization processes. Files Changed:
Code AnalysisWe ran Riskiness🟢 Risk threshold not exceeded. |
- references to `JwtService::decode_claims` updated to `JwtService::decode_tokens` Signed-off-by: rmarinn <[email protected]>
- add test that should error when a key with a given `kid` that should be used for validating a token can't be found. - add a test that panics when the openid configuration cannot be fetched at JwtService's initialization. the openid configuration cannot be fetched - add a test that panics when the JWKS cannot be fetched at JwtService's initialization. Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
…_jwt_validation.rs Signed-off-by: rmarinn <[email protected]>
- moved `can_update_local_jwks` from `with_validation.rs` to `key_service.rs` Signed-off-by: rmarinn <[email protected]>
- updated docstrings on some test files to more accurately indicate what they contain. - remove unnecessary "unexpected" data checks on tests and just have it on one. Signed-off-by: rmarinn <[email protected]>
Prepare
Description
This PR adds tests for
JwtService
to improve test coverage. Please see the target issue for the tests covered.Target issue
target issue: #9995
closes #9995
Implementation Details
Test and Document the changes
Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with
docs:
to indicate documentation changes or if the below checklist is not selected.