Skip to content
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

Extending JWT claims validation to support other claims #5418

Open
hubodz opened this issue Jan 29, 2025 · 2 comments
Open

Extending JWT claims validation to support other claims #5418

hubodz opened this issue Jan 29, 2025 · 2 comments

Comments

@hubodz
Copy link

hubodz commented Jan 29, 2025

Based on source, I understand only limited number of JWT claims can be validated. Trying to validate other claims result in error unknown_checks.
I would like to ask for introducing validation any provided claim.

In my case, I use an SSO of a huge Organisation, where many users can define their own applications/clients (signed with same SSO key). Without validating aud, anyone could create another application with roles that my CouchDB instance accepts.

Desired Behaviour

When provided a config like below, the claim aud should be verified: both if it exists and if it matched provided my-application value.

required_claims = exp, {aud, "my-application"}

I believe it's worth allowing such a validation for any custom claim (only to check existence and value matching, if provided).

Possible Solution

I believe the source should not limit the check only to claims specified in line 45. There could be a function providing a "general" claim check, no matter what it is exactly.

@rnewson
Copy link
Member

rnewson commented Feb 3, 2025

hm I think a pull request to add aud specifically would be fine (and should be fairly easy). Not sure bespoke checks are a good idea.

@hubodz
Copy link
Author

hubodz commented Feb 6, 2025

Hey, thanks for your answer. Can you tell me more about why the bespoke checks would be a bad idea (as long as it's a simple string comparison)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants