mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 16:11:48 -05:00
fix(sts): cap account-root token durations at one hour (#7125)
* fix(sts): cap account-root token durations at one hour Cap GetSessionToken and GetFederationToken credentials issued to the account-root identity at one hour, preserving IAM user durations and validation ordering. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> * test(sts): bound root token expiry by request time Check the one-hour default using timestamps captured before the request and after the response, allowing millisecond wire precision. Preserve the root duration cap. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> --------- Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
1 parent
dc04c47791
commit
81e1dbc573
5 files changed
+158
-3
No files matched your search
@@ -350,11 +350,16 @@ class StsTest {
|
||||
|
||||
@Test
|
||||
void getSessionTokenDefaultDuration() {
|
||||
Instant beforeRequest = Instant.now();
|
||||
GetSessionTokenResponse response = sts.getSessionToken(
|
||||
GetSessionTokenRequest.builder().build());
|
||||
Instant afterResponse = Instant.now();
|
||||
|
||||
assertThat(response.credentials()).isNotNull();
|
||||
assertThat(response.credentials().expiration()).isAfter(Instant.now().plusSeconds(3600));
|
||||
// Root credentials default to one hour; wire timestamps have millisecond precision.
|
||||
assertThat(response.credentials().expiration()).isBetween(
|
||||
beforeRequest.plusSeconds(3600).minusMillis(1),
|
||||
afterResponse.plusSeconds(3600).plusMillis(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user