common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
1.06k stars 94 forks source link

Fix export lookup values when exporting credentials #578

Closed cedieio closed 9 months ago

cedieio commented 9 months ago

What changed?

When session is present on the config it should be where we get the start_url and region. Most configs will not have said config under profile if they have a session block. Session block takes priority for the configuration as it's considered as it's connecting profiles together.

Fix for #577

Why?

Although it's working properly for awscli the generated token does not contain sso_start_url which could be problematic for other code that relies on that property when looking for a valid config.

How did you test it?

dassume --export-sso-token

cat ~/.aws/sso/cache/<corresponding json> should give out

{
   "accessToken"some_access_token",
   "expiresAt":"2023-12-20T19:31:16+10:00",
   "ssoSessionName":"test-session",
   "startUrl":"https://test.com",
   "region":"ap-southeast-2"
}

Potential risks

Is patch release candidate?

Link to relevant docs PRs