-
Notifications
You must be signed in to change notification settings - Fork 13
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
Changed audience check to check against each configured audience, updated tests #70
Changed audience check to check against each configured audience, updated tests #70
Conversation
WalkthroughThe recent changes address a bug related to multiple audience claims in token validation. Specifically, the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
src/utils/isTokenValid/isTokenValid.ts (1)
Line range hint
4-4
: Consider replacingany
type with more specific types fortoken
andconfig
parameters to enhance type safety and code maintainability.- const isTokenValid = (token: any, config: any) => { + const isTokenValid = (token: TokenInterface, config: ConfigInterface) => {
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/utils/isTokenValid/isIDTokenValid.test.ts (2 hunks)
- src/utils/isTokenValid/isTokenValid.ts (1 hunks)
Additional context used
Biome
src/utils/isTokenValid/isTokenValid.ts
[error] 4-4: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
[error] 4-4: Unexpected any. Specify a different type. (lint/suspicious/noExplicitAny)
any disables many type checking rules. Its use should be avoided.
Additional comments not posted (3)
src/utils/isTokenValid/isTokenValid.ts (1)
32-36
: The updated audience validation logic now checks each element of the audience array against the configuration, which aligns with the PR objectives to handle multiple audiences correctly.src/utils/isTokenValid/isIDTokenValid.test.ts (2)
6-6
: The update to theaud
field in the configuration object to include an additional identifier is necessary to align with the changes in theisTokenValid
function and correctly handle multiple audiences.
114-114
: Ensure the error message reflects the new expected audience format correctly, which now includes multiple identifiers.Verification successful
The error message in the test file correctly reflects the new expected audience format, which includes multiple identifiers.
- Location:
src/utils/isTokenValid/isIDTokenValid.test.ts
, line 114Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the error message for audience mismatch includes all identifiers. # Test: Search for the error message in the test file. Expect: Error message includes all identifiers. rg --type typescript $'Expected: "https://account.acme.com 123456789"' src/utils/isTokenValid/isIDTokenValid.test.tsLength of output: 152
Script:
#!/bin/bash # Description: Verify the error message for audience mismatch includes all identifiers. # Test: Search for the error message in the test file. Expect: Error message includes all identifiers. rg --type ts $'Expected: "https://account.acme.com 123456789"' src/utils/isTokenValid/isIDTokenValid.test.tsLength of output: 204
Thanks for this @rudolf-erasmus great addition 🚀 |
Fix multiple audiences error
Fixes #69 - When using multiple audiences we get a "(aud) claim mismatch" error
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.