-
Notifications
You must be signed in to change notification settings - Fork 217
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
JwtAuthnPolicy could validate the key_issuer against iss #5809
Comments
Key points
|
After implementing the above, I've faced a complication. Currently, we have only one tables in the KV to map the kid to issuer. The problem is, that for MSFT Entra multitenancy mode, we have to compare the token.iss claim against the "issuer" specified in the key. E.g., as the doc above says, we will have the issuer argument = As soon as the multitenant endpoint can (and probably will) provide multiple keys with different issuers, I first decided to overwrite the original issue in the kid->issuer table and this worked well. However, as I revealed in tests, this breaks down The only way to fix it I came up with is change the schema (extend kid->issuer or add new table). Needs to be discussed further. |
@maxtropets I think what this effectively means is that fixing #5177 first is necessary. Let's discuss this with @eddyashton. |
To clarify, there are potentially two tables where this is a problem:
In addition to this, I think we also need to keep a mapping of |
Regarding the first one - it seems they carry the same public key. In common Entra endpoint, the first non-common tenant in the keys is It exposes it's own OpenID keys at https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0/.well-known/openid-configuration If we go to the keys in there, we can find the Both keys with However we don't see anything said that this's an expected behaviour, and I don't really see how we can deal with that. |
Regarding the second point about different issuer constraints. It seems it's not true for the keys published right now, because the keys they point to, which are
seem to an alias of the same document - the contents are identical. However we also don't have anything saying it's guaranteed to not happen. |
I believe that for the same top level issuer, but not across actually different issuers (not just ADD/tenant).
Exactly. I think it's probably mostly true, but it's very easy to imagine configurations where that would not be. So I think we want a design that can cope with that, even if it maybe doesn't have to. |
#6175 opened for review. Must-knows before review
|
Decided to complete follow-up tickets in this PR to avoid scattering between releases |
Done in #6175 |
JwtAuthnPolicy
currently exposes an authenticatedkey_issuer
, and an un-checkediss
field from the token. It is up to the application code to check that they match (which should be the case when the standard is followed), and to include logic used to implement multi-tenant support for example, when applicable.We could improve on this by:
key_issuer
==iss
key_issuer
using the AAD-specific logic described in the link above and thetid
This would break neither standards-compliant, nor AAD use cases, and would reduce the risk of incorrect token validation by the application code.
Tasks
The text was updated successfully, but these errors were encountered: