common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
956 stars 90 forks source link

fix runtime error when sso token expires #627

Closed shwethaumashanker closed 3 months ago

shwethaumashanker commented 3 months ago

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:

Potential risks

Is patch release candidate?

Link to relevant docs PRs