-
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
[buddy] Truncate AssumeRole session name to API limits #45202
Conversation
Co-authored-by: STeve (Xin) Huang <[email protected]>
lib/utils/aws/credentials.go
Outdated
@@ -74,7 +74,7 @@ func (g *credentialsGetter) Get(_ context.Context, request GetCredentialsRequest | |||
logrus.Debugf("Creating STS session %q for %q.", request.SessionName, request.RoleARN) | |||
return stscreds.NewCredentials(request.Provider, request.RoleARN, | |||
func(cred *stscreds.AssumeRoleProvider) { | |||
cred.RoleSessionName = request.SessionName | |||
cred.RoleSessionName = TruncateRoleSessionName(request.SessionName) |
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.
Same remark about clashes here.
lib/utils/aws/aws.go
Outdated
|
||
// MaxRoleSessionName is the maximum length of the role session name used by the AssumeRole call. | ||
// https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html | ||
MaxRoleSessionName = 64 |
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: just to make it explicit that this is not count but name length.
MaxRoleSessionName = 64 | |
MaxRoleSessionNameLength = 64 |
@@ -2745,6 +2745,13 @@ message AppSessionStart { | |||
(gogoproto.embed) = true, | |||
(gogoproto.jsontag) = "" | |||
]; | |||
|
|||
// AWS contains common AWS session information. | |||
AWSSessionMetadata AWS = 9 [ |
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.
Can we make it more generic like
AWSSessionMetadata AWS = 9 [ | |
AWSMetadata AWS = 9 [ |
I wonder what other fields can be added to AWSSessionMetadata, where AWSMetadata would be more flexible and in the case of other AWS fields not related to AWSSession context I think that the AWSMetadata it will be a better fit.
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.
It seems like this exploded in scope a bit with the audit and proto changes. I would do audit separately, but happy to keep it here if you prefer.
I feel the same but it's not an easy fix. I decided to drop the audit from the PR and make the fix separately. Another issue with current design (how the session event is sent) is the event happens on the root but not on the leaf. -- update |
* 44833 Truncate AssumeRole session name to API limits * Link reference Co-authored-by: STeve (Xin) Huang <[email protected]> * Hash the username and add audit log * review comments * remove audit --------- Co-authored-by: Joao Ubaldo <[email protected]>
* 44833 Truncate AssumeRole session name to API limits * Link reference Co-authored-by: STeve (Xin) Huang <[email protected]> * Hash the username and add audit log * review comments * remove audit --------- Co-authored-by: Joao Ubaldo <[email protected]>
* 44833 Truncate AssumeRole session name to API limits * Link reference Co-authored-by: STeve (Xin) Huang <[email protected]> * Hash the username and add audit log * review comments * remove audit --------- Co-authored-by: Joao Ubaldo <[email protected]>
* [buddy] Truncate AssumeRole session name to API limits (#45202) * 44833 Truncate AssumeRole session name to API limits * Link reference Co-authored-by: STeve (Xin) Huang <[email protected]> * Hash the username and add audit log * review comments * remove audit --------- Co-authored-by: Joao Ubaldo <[email protected]> * reintroduce logrus --------- Co-authored-by: Joao Ubaldo <[email protected]>
* 44833 Truncate AssumeRole session name to API limits * Link reference * Hash the username and add audit log * review comments * remove audit --------- Co-authored-by: Joao Ubaldo <[email protected]>
* 44833 Truncate AssumeRole session name to API limits * Link reference * Hash the username and add audit log * review comments * remove audit --------- Co-authored-by: Joao Ubaldo <[email protected]>
Fixes #44833
buddy PR:
changelog: Fixed an issue AWS access fails when the username is longer than 64 characters