Fix setting pending request TTL pass the access expiry time#39548
Merged
Conversation
82d3169 to
3855f71
Compare
Collaborator
|
Recommend replacing "pass" with "beyond" in the changelog entry. |
Contributor
Author
Contributor
Author
|
friendly ping @jakule @fspmarshall |
fspmarshall
approved these changes
Mar 20, 2024
jakule
approved these changes
Mar 21, 2024
Contributor
jakule
left a comment
There was a problem hiding this comment.
LGTM, I think we're only missing a test that covers session TTL, max duration and pending expiry.
| // calculatePendingRequestTTL calculates the TTL of the Access Request (how long it will await | ||
| // approval). request TTL is capped to the smaller value between the const requsetTTL and the | ||
| // access request access expiry. | ||
| func (m *RequestValidator) calculatePendingRequestTTL(ctx context.Context, identity tlsca.Identity, r types.AccessRequest) (time.Duration, error) { |
Contributor
There was a problem hiding this comment.
nit: ctx and identity are not being used in the receiver.
3855f71 to
41961cc
Compare
f8a13c2 to
9ba1a81
Compare
9ba1a81 to
30fa6d0
Compare
Collaborator
|
/excludeflake * |
mdwn
pushed a commit
that referenced
this pull request
Mar 26, 2024
* Prevent setting pending request TTL pass the access expiry time * Allow setting max duration less than sessionTTL when role max_duration is not set * Add more test, clarify comment * Remove unused params * Add a test for respecting both pending and max duration request * Add a fakeclock to fix access request time diff check differences
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 28, 2024
* Set default access request TTL to 1 week. The TTL for a request now defaults to 1 week. This will allow reviewers more time to review an access request before it disappears. Co-authored-by: Lisa Kim <lisa@goteleport.com> * Fix setting pending request TTL pass the access expiry time (#39548) * Prevent setting pending request TTL pass the access expiry time * Allow setting max duration less than sessionTTL when role max_duration is not set * Add more test, clarify comment * Remove unused params * Add a test for respecting both pending and max duration request * Add a fakeclock to fix access request time diff check differences --------- Co-authored-by: Lisa Kim <lisa@goteleport.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
part of #35436
recommend reviewing by commit
There's two commits to this PR:
Mostly about preventing users from setting a pending request TTL pass the access expiry time. This led to the access request being in the list pass its access expiry time, and it disappears from the list right after approving.
When a
role max_durationisn't set it meansmax_duration: 0. Before, if a user sent a request with a max duration, this max duration got silently ignored and got set to thesession TTLinstead. So if my sessionTTL is 12 hours, and user requested a duration of1hr, it got overwrote to12 hours. This PR allows requested max duration less than the sessionTTL to be respected.