Versent / saml2aws

CLI tool which enables you to login and retrieve AWS temporary credentials using a SAML IDP

Home Page:https://github.com/Versent/saml2aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic: runtime error: index out of range [1] with length 1

Devansh2290 opened this issue · comments

I have configured saml2aws on my new macbook pro M1 chip, and when trying to login into aws using following command getting this error:

command:

saml2aws login --session-duration=43200 --username=<email id> --mfa='DUO' --duo-mfa-option='Duo Push' --skip-prompt  --force --role='arn:aws:iam::<account>:<role>'

Error:

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/versent/saml2aws/v2/pkg/provider/okta.verifyMfa(0x140003f4cc0, {0x140003de2d9, 0xf}, 0x140001584d0, {0x1400042c380, 0x336})
        github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:975 +0x6dfc
github.com/versent/saml2aws/v2/pkg/provider/okta.(*Client).Authenticate(0x140003f4cc0, 0x140001584d0)
        github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:481 +0x184
github.com/versent/saml2aws/v2/pkg/provider/okta.(*Client).authWithSession(0x140003f4cc0, 0x140001584d0)
        github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:300 +0xbc
github.com/versent/saml2aws/v2/pkg/provider/okta.(*Client).Authenticate(0x140003f4cc0, 0x140001584d0)
        github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:463 +0x54
github.com/versent/saml2aws/v2/cmd/saml2aws/commands.Login(0x14000154cc0)
        github.com/versent/saml2aws/v2/cmd/saml2aws/commands/login.go:105 +0x37c
main.main()
        github.com/versent/saml2aws/v2/cmd/saml2aws/main.go:191 +0x7240

$ saml2aws --version
2.36.8

What I did to make it work is to comment

--mfa='DUO' \
--duo-mfa-option='Duo Push' \
--skip-prompt

then run it again, write password and chose DUO from the list. After successful login I uncomment it and it works again.

Seeing the same issue on Mac Intel. I have the latest version: 2.36.10

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/versent/saml2aws/v2/pkg/provider/okta.verifyMfa(0xc00047aed0, {0xc0004663c9, 0x13}, 0xc0001ce4d0, {0xc0000f0380, 0x36b})
	github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:986 +0x8645
github.com/versent/saml2aws/v2/pkg/provider/okta.(*Client).Authenticate(0xc00047aed0, 0xc0001ce4d0)
	github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:481 +0x1c6
github.com/versent/saml2aws/v2/pkg/provider/okta.(*Client).authWithSession(0xc00047aed0, 0xc0001ce4d0)
	github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:300 +0xfe
github.com/versent/saml2aws/v2/pkg/provider/okta.(*Client).Authenticate(0xc00047aed0, 0xc0001ce4d0)
	github.com/versent/saml2aws/v2/pkg/provider/okta/okta.go:463 +0x7f
github.com/versent/saml2aws/v2/cmd/saml2aws/commands.Login(0xc0001cad80)
	github.com/versent/saml2aws/v2/cmd/saml2aws/commands/login.go:105 +0x4da
main.main()
	github.com/versent/saml2aws/v2/cmd/saml2aws/main.go:191 +0x76f8
```

What I did to make it work is to comment

--mfa='DUO' \
--duo-mfa-option='Duo Push' \
--skip-prompt

then run it again, write password and chose DUO from the list. After successful login I uncomment it and it works again.

Is this the fix?

@mapkon did not work.
What work for me is

saml2aws login

after entering credentials and role selections and have run the following and it is working but the issue is still here when I ran the following command for the first time in a day. So daily I need to run saml2aws login the first time every day and after that following command works without any issue:

saml2aws login --session-duration=43200 --username=<email id> --mfa='DUO' --duo-mfa-option='Duo Push' --skip-prompt  --force --role='arn:aws:iam::<account>:<role>'

The issue still exists I have tried:

What I did to make it work is to comment

--mfa='DUO'
--duo-mfa-option='Duo Push'
--skip-prompt
then run it again, write password and chose DUO from the list. After successful login I uncomment it and it works again.