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

fix runtime error when sso token expires #627

Merged
merged 1 commit into from Mar 28, 2024

Conversation

shwethaumashanker
Copy link
Contributor

@shwethaumashanker shwethaumashanker commented Mar 28, 2024

What changed?

Added nil pointer handling

Why?

Requesting access with a expired SSO token gave the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x100989ba4]

goroutine 1 [running]:
gopkg.in/ini%2ev1.(*Section).GetKey(0x0, {0x100b1fddd?, 0x16f8aaf6f?})
        /Users/runner/go/pkg/mod/gopkg.in/ini.v1@v1.67.0/section.go:109 +0x24
github.com/common-fate/granted/pkg/cfaws.(*Profile).SSOScopes(0x16f8aaf6f?)

How did you test it?

Locally reproduced the error and tested that the fix works.
How to test:

  • Delete sso token
  • run assume --sso --sso-start-url https://qwertyui.awsapps.com/start --sso-region ap-southeast-2 --account-id 123456789 --role-name AdministratorAccess (This will give error)
  • run dassume --sso --sso-start-url https://qwertyui.awsapps.com/start --sso-region ap-southeast-2 --account-id 123456789 --role-name AdministratorAccess (fix)

Potential risks

Is patch release candidate?

Link to relevant docs PRs

@chrnorm chrnorm merged commit 6155a27 into main Mar 28, 2024
3 checks passed
@chrnorm chrnorm deleted the fix-runtime-error-when-sso-token-expires branch March 28, 2024 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants