-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
identity: do not allow a role's token_ttl to be longer than verification_ttl #12151
Conversation
When updating a key, ensure any roles referencing the key do not already have a token_ttl greater than the key's verification_ttl
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.
We could also consider changing the line where we ultimately set on ID token's Expiry value during token generation by using the floor of the two.
In that case, would we want to add a warning if we are not using a value set by the user explicitly? It does seem like a simpler option. |
Yeah, a warning would be useful. I also didn't imply that we should remove the checks that you added. I was suggesting that we could do both :) |
- remove make slice in favor of var delcaration - remove unneeded if check - validate expiry value during token generation - update changelog as bug
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.
Few comments, but otherwise looks good!
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.
One comment, looks good otherwise!
Co-authored-by: Austin Gebauer <[email protected]>
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.
LGTM!
…ion_ttl (#12151) * do not allow token_ttl to be longer than verification_ttl * add verification when updating an existing key When updating a key, ensure any roles referencing the key do not already have a token_ttl greater than the key's verification_ttl * add changelog * remove unneeded UT check and comment * refactor based on PR comments - remove make slice in favor of var delcaration - remove unneeded if check - validate expiry value during token generation - update changelog as bug * refactor get roles referencing target key names logic * add note about thread safety to helper func * update func comment * sort array and refactor func names * add warning to return response * remove unnecessary code from unit test * Update vault/identity_store_oidc.go Co-authored-by: Austin Gebauer <[email protected]> Co-authored-by: Austin Gebauer <[email protected]>
…ion_ttl (#12151) (#12213) * do not allow token_ttl to be longer than verification_ttl * add verification when updating an existing key When updating a key, ensure any roles referencing the key do not already have a token_ttl greater than the key's verification_ttl * add changelog * remove unneeded UT check and comment * refactor based on PR comments - remove make slice in favor of var delcaration - remove unneeded if check - validate expiry value during token generation - update changelog as bug * refactor get roles referencing target key names logic * add note about thread safety to helper func * update func comment * sort array and refactor func names * add warning to return response * remove unnecessary code from unit test * Update vault/identity_store_oidc.go Co-authored-by: Austin Gebauer <[email protected]> Co-authored-by: Austin Gebauer <[email protected]> Co-authored-by: John-Michael Faircloth <[email protected]> Co-authored-by: Austin Gebauer <[email protected]>
Fixes issue #11441 which reported that OIDC identity tokens can have a TTL longer than their signing key will be visible.
Tests
Test role invalid TTL
Test that an attempt to create a new role checks that the token
ttl
is not greater than the key'sverification_ttl
Error:
Test key invalid TTL
Test that an update to an existing key that is referenced by a role cannot have its
verification_ttl
exceed the role'sttl
Error: