Skip to content

Commit

Permalink
provider: ensure ExpiryWindow < TokenDuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Jul 29, 2024
1 parent 8f32602 commit 0f0904e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/credentials/provider/oidc_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ func (o *OIDCProviderOptions) applyDefaults() {
}
if o.ExpiryWindow == 0 {
o.ExpiryWindow = defaultExpiryWindowForAssumeRole
if o.TokenDuration > 0 && o.TokenDuration <= o.ExpiryWindow {
o.ExpiryWindow = o.TokenDuration / 2
}
}
if o.EnvRoleArn == "" {
o.EnvRoleArn = defaultEnvRoleArn
Expand Down
2 changes: 1 addition & 1 deletion pkg/credentials/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ type Stopper interface {

func init() {
name := path.Base(os.Args[0])
UserAgent = fmt.Sprintf("%s %s/%s ack-ram-tool/%s", name, runtime.GOOS, runtime.GOARCH, runtime.Version())
UserAgent = fmt.Sprintf("%s %s/%s ack-ram-tool/provider/%s", name, runtime.GOOS, runtime.GOARCH, runtime.Version())
}
3 changes: 3 additions & 0 deletions pkg/credentials/provider/rolearn_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ func (o *RoleArnProviderOptions) applyDefaults() {
}
if o.ExpiryWindow == 0 {
o.ExpiryWindow = defaultExpiryWindowForAssumeRole
if o.TokenDuration > 0 && o.TokenDuration <= o.ExpiryWindow {
o.ExpiryWindow = o.TokenDuration / 2
}
}
if o.Logger == nil {
o.Logger = defaultLog
Expand Down

0 comments on commit 0f0904e

Please sign in to comment.