-
Notifications
You must be signed in to change notification settings - Fork 423
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
Role assumption names #134
Role assumption names #134
Conversation
When using a federated user session in conjunction with the -r role assumption option, some of the fidelity of that initial session is lost (ex: caller-specified-name from https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) This will conditionally check, if a new role is asked to be assumed, if there is already an existing role specified and if so, it will pass it through to the new session to allow for easier auditing of users as they traverse more complex IAM role delegation structures.
- Disabled automatic session name mapping for federated users and creating feature flag for explicit "opt-in" of the option. - Explanation and disclaimer added to README - Small linting error to pass `make test`
pkg/token/token.go
Outdated
@@ -181,9 +184,29 @@ func (g generator) GetWithRoleForSession(clusterID string, roleARN string, sess | |||
|
|||
// if a roleARN was specified, replace the STS client with one that uses | |||
// temporary credentials from that role. | |||
if roleARN != "" { | |||
if roleARN != "" && g.forwardSessionName { |
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.
You'll need a separate if g.forwardSessionName
within the if roleARN != ""
, this is bypassing role assumption if they aren't forwarding the session name
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.
Great point! Thanks.
- Fixes a bug where the role would not be appropriately assumed when users that are federated did not specify the new `forward-session-name` argument
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.
The code looks good, can you just clean up the doc strings in the code?
pkg/token/token.go
Outdated
if g.forwardSessionName { | ||
// Determine if the current session is already a federated identity. If so, | ||
// we carry through this session name onto the new session to provide better | ||
// aduiting capabilities |
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 you change this from 'auditing' to 'debugging'?
pkg/token/token.go
Outdated
// we carry through this session name onto the new session to provide better | ||
// aduiting capabilities | ||
// | ||
// NOTE: I couldn't figure out a more `direct` way of indicating if the |
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 you remove this note?
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jrnt30, mattlandis The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #120
See conversation from #121 for additional context/discussion
When using a federated user session in conjunction with
the -r role assumption option, some of the fidelity of that
initial session is lost (ex: caller-specified-name from
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable)
This will conditionally check, if a new role is asked to be assumed,
if there is already an existing role specified and if so, it will
pass it through to the new session to allow for easier auditing
of users as they traverse more complex IAM role delegation structures.