saml2aws: saml2aws fails to login to newly revamped login page
Attempting to login to AWS now fail with the following error:
Failed to assume role. Please check whether you are permitted to assume the given role for the AWS service.: No accounts available.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 77
- Comments: 21 (2 by maintainers)
It appears the login page update was rolled back on the AWS side.
Here’s a quick patch of something that seems to be working locally:
I make no guarantees for how well it works for all edgecases 😃
Huge thanks to @MichaelPalmer1 for discovering the meta tag which made this a lot easier.
Seeing the same here.
The role data can be pulled from the
<meta name="data" content="[base64 encoded json object containing role information]">.This makes it a lot cleaner actually.
When decoded, this is the essential piece:
The https://signin.aws.amazon.com/saml UI has changed and now there are dashes on the account numbers and there weren’t before and the page is drastically different. Looks like saml2aws scrapes this screen from code above found by @ReagentX . And there’s no
fieldseton the page any longer.I’m the author of the PR to implement a fix for gimme-aws-creds and I wanted to drop a note here that if it helps folks working to patch saml2aws, I did dump the new NextJS sign-in page before AWS rolled back earlier today. I have that saved as a sanitized mock file for use as a fixture for the tests for gimme-aws-creds. You can review that file at https://github.com/Nike-Inc/gimme-aws-creds/blob/master/tests/fixtures/aws_nextjs.html
Hope that helps author a patch for saml2aws 🫡
Seems to come from:
https://github.com/Versent/saml2aws/blob/ca63a28969851e5de7c4159face407cfeecae7db/aws_account.go#L35-L57
I was a little worried about that. It makes supporting it a little more painful since we won’t be able to get a good test without the live page… 😢 (jokes on me for not saving it to disk to formulate a testdata entry)
We probably want to support both methods in a PR in case it switches back and forth again, too.
Here is a sample of the HTML for the role table:
And here is a sample of the JSON blob in
<meta name="data" content="[base64 blob]">after base64 decoding:Great rally though!
Based on the RCA from AWS, they mentioned
Logins to other Regions were not affected and existing authentication sessions were not impacted., so the change only impacted US-EAST-1. I would suggest to keep the oldsaml-accountdiv tag parser, and add the new logic to better support all regions.Another quick workaround, in case you don’t want to mess with the saml2aws code or the assume role API calls directly:
aws configure export-credentials --format env.Starting today it appears that the azure login fails to return roles. This was working a few days ago with 0 changes to the saml2aws version, IAM roles, or Azure AD. Not sure if others are experiencing this caused by some change from AWS or Azure?