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

Fix using default duration on auto approved requests #748

Merged

Conversation

meyerjrr
Copy link
Contributor

@meyerjrr meyerjrr commented Sep 17, 2024

What changed?

Updated the access request hooks to use the Duration returned by the batch ensure API to show how long access was requested for. Where a request is already active, the remaining duration is calculated.

Why?

Access requests that required access to be assigned with Common Fate was returning incorrect values for the duration on the request.

How did you test it?

Ran assume without the change and observed the bug present.
Reran the same command and got the expected output of the default duration.

With specifying duration

dassume  dev.test/Billing -d 1h
[i] You don't currently have access to dev.test/Billing, checking if we can request access... [target=AWS::Account::"123456789012", role=Billing, url=http://localhost:9090]
[WILL ACTIVATE] Billing access to test will be activated for 1h: http://localhost:8080/access/requests/req_2mBcrs8p9mF9Y7ZqaCEQcaoF7ZR
? Apply proposed access changes Yes
[i] Attempting to grant access...
? Reason for access (Required) test
[ACTIVATED] Billing access to test was activated for 1h: http://localhost:8080/access/requests/req_2mBcsCc6S5C0Z0dPyHMdXRQRBYz
[✔] [dev.test/Billing](ap-southeast-2) session credentials will expire in 1 hour

When not specifying duration, defaults to using the default duration

dassume  dev.test/Billing 
[i] You don't currently have access to dev.test/Billing, checking if we can request access... [target=AWS::Account::"123456789012", role=Billing, url=http://localhost:9090]
[WILL ACTIVATE] Billing access to test will be activated for 5m: http://localhost:8080/access/requests/req_2mBcw1qVFNVrRfxVZ13nc8iuhj6
? Apply proposed access changes Yes
[i] Attempting to grant access...
? Reason for access (Required) test
[ACTIVATED] Billing access to test was activated for 5m: http://localhost:8080/access/requests/req_2mBcwLqKRDxTUaEKq53Lt8FoQj8

Potential risks

Is patch release candidate?

Link to relevant docs PRs

@JoshuaWilkes
Copy link
Contributor

I've updated this PR to use the Duration field which was added a few months ago, this now reports exactly how long the grant was requested for, or how long is remaining on an active grant.

@JoshuaWilkes JoshuaWilkes merged commit b114bb5 into main Sep 19, 2024
3 checks passed
@JoshuaWilkes JoshuaWilkes deleted the fix-using-default-duration-on-auto-approved-requests branch September 19, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants