aws / aws/aws-cli

SSO login doesn't report an error when a user cannot assume a role on an account

Open
#6,316 22 comments 14 reactions 0 assignees View on GitHub
enhancement feature-request p2 sso
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x] I've gone though the [User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) and the [API reference](https://docs.aws.amazon.com/cli/latest/reference/)
- [x] I've searched for [previous similar issues](https://github.com/aws/aws-cli/issues) and didn't find any solution

**Describe the bug**
When authenticating to AWS SSO with a valid identity, SSO will always report success. It does not report an error if the specified role cannot be assumed.

**SDK version number**
2.1.35

**Platform/OS/Hardware/Device**
Debian bullseye

**To Reproduce (observed behavior)**
1. Have an account that is managed by AWS SSO
1. Have a role that is assigned to this account in AWS SSO
2. Have a user identity that can authenticate with AWS SSO, but that is not authorized to use this role on this account
3. Create a corresponding profile in `~/.aws/config`
4. Run `aws sso login`
5. Authenticate in the web browser

**Expected behavior**
The browser or the CLI should report an error that login was successful, but that the role cannot be assumed on the account.

**Logs/output**
Both the browser and CLI report success.
Running any AWS CLI commands afterwards will fail; even `aws sts get-caller-identity` will report an error and not display any identity information.

**Additional context**
Since neither the CLI nor the AWS SSO login portal display any information about the users identity, it's very hard to debug this issue if you don't know what to look for. The user may already have an cookie set on their identity provider or have auto-login enabled through GSSAPI. In this case, they would immediately be logged in without any interaction.

Some environments may require users to use multiple identities, making the problem even more cumbersome.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.