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

Allow an optional IAM policy to be specified when assuming roles #254

Open
stoggi opened this issue May 14, 2018 · 2 comments
Open

Allow an optional IAM policy to be specified when assuming roles #254

stoggi opened this issue May 14, 2018 · 2 comments
Labels

Comments

@stoggi
Copy link
Contributor

stoggi commented May 14, 2018

When you assume a role with AWS, you can optionally provide an IAM policy.

If you pass a policy, the temporary security credentials that are returned by the operation have the permissions that are allowed by both (the intersection of) the access policy of the role that is being assumed, and the policy that you pass. This gives you a way to further restrict the permissions for the resulting temporary security credentials. You cannot use the passed policy to grant permissions that are in excess of those allowed by the access policy of the role that is being assumed.

This would let me create temporary credentials with scoped permissions. Particularly handy for one-off tasks that you don't want to create a new role for, but want least privilege. Another use case is documenting an IAM policy for your project that other users can start with aws-vault, so that it's clear what permissions your service requires.

An example using the AWS CLI:

aws-vault exec user-with-mfa -- aws sts assume-role \
  --role-arn arn:aws:iam::1234567890123:role/role-name \
  --role-session-name your-session-name \
  --policy "$(cat scoped-policy.json)"

What I'd like to be able to do:

aws-vault exec --policy=scoped-policy.json role-name

I'm happy to create a PR for this option, and add it to the exec command. Any thoughts?

I don't like how the AWS cli expects JSON as a string, and I would just specify a filename instead.

https://docs.aws.amazon.com/cli/latest/reference/sts/assume-role.html#options
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html

@FernandoMiguel
Copy link
Collaborator

/sub

@stale
Copy link

stale bot commented Jun 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 23, 2019
@stale stale bot closed this as completed Jun 30, 2019
@mtibben mtibben closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
@mtibben mtibben added feature and removed stale labels Mar 15, 2023
@mtibben mtibben reopened this Mar 15, 2023
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