-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix setting pending request TTL pass the access expiry time #39548
Conversation
82d3169
to
3855f71
Compare
Recommend replacing "pass" with "beyond" in the changelog entry. |
friendly ping @jakule @fspmarshall |
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, I think we're only missing a test that covers session TTL, max duration and pending expiry.
lib/services/access_request.go
Outdated
// 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) { |
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.
nit: ctx and identity are not being used in the receiver.
3855f71
to
41961cc
Compare
f8a13c2
to
9ba1a81
Compare
9ba1a81
to
30fa6d0
Compare
/excludeflake * |
* 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
* 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 <[email protected]> * 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 <[email protected]>
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_duration
isn'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 TTL
instead. 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.