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

AWS IAM provider fails to renew token upon expiration #934

Closed
febg opened this issue Jun 29, 2020 · 2 comments
Closed

AWS IAM provider fails to renew token upon expiration #934

febg opened this issue Jun 29, 2020 · 2 comments
Labels

Comments

@febg
Copy link
Contributor

febg commented Jun 29, 2020

The AWS IAM provider adds a 5 minute time delta to the actual expiration time of the token provided by AWS.

), expiration + timedelta(minutes=5)

This causes a 5 minute period of time in which the SDK is operating with expired credentials before asking for a new token.

@harshavardhana
Copy link
Member

This causes 5 minute period of time in which the SDK is operating with expired credentials before asking for a new token.

The best way is to have something like a delta which negates not adds - look at the API here

https://pkg.go.dev/github.com/minio/minio-go/v6@v6.0.57/pkg/credentials?tab=doc#Expiry.SetExpiration

// SetExpiration sets the expiration IsExpired will check when called.
//
// If window is greater than 0 the expiration time will be reduced by the
// window value.
//
// Using a window is helpful to trigger credentials to expire sooner than
// the expiration time given to ensure no requests are made with expired
// tokens.
func (e *Expiry) SetExpiration(expiration time.Time, window time.Duration) {
	e.expiration = expiration
	if window > 0 {
		e.expiration = e.expiration.Add(-window)
	}
}

https://github.com/minio/minio-go/blob/51222d26253e90224f8b4f8ba9be9b7982e3ce53/pkg/credentials/iam_aws.go#L40

https://github.com/minio/minio-go/blob/51222d26253e90224f8b4f8ba9be9b7982e3ce53/pkg/credentials/iam_aws.go#L140

@febg
Copy link
Contributor Author

febg commented Jun 29, 2020

@harshavardhana I changed the time delta addition to a subtraction in PR #935.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants