-
Notifications
You must be signed in to change notification settings - Fork 501
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(auth): malformed SSO cache didn't prompt reauth #6164
Merged
nkomonen-amazon
merged 4 commits into
aws:master
from
nkomonen-amazon:feature/postreinvent
Dec 11, 2024
Merged
fix(auth): malformed SSO cache didn't prompt reauth #6164
nkomonen-amazon
merged 4 commits into
aws:master
from
nkomonen-amazon:feature/postreinvent
Dec 11, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
justinmk3
approved these changes
Dec 5, 2024
jpinkney-aws
approved these changes
Dec 6, 2024
8928bbe
to
071dc49
Compare
Problem: When we loaded sso cache from disk, we would only invalidate (leading to a reauth prompt) if the cache file was missing. But if the cache file was present, though its content was malformed, we would incorrectly treat it as recoverable by throwing instead of returning undefined. Solution: If we detect a SyntaxError treat it as non-recoverable, meaning it will trigger a reauth. Also added some code to validate the content of the SSO cache we loaded from disk to ensure it is what we expected. Signed-off-by: nkomonen-amazon <[email protected]>
Signed-off-by: nkomonen-amazon <[email protected]>
just added in a missing value in the test data that was causing validation to fail Signed-off-by: nkomonen-amazon <[email protected]>
071dc49
to
b1ada55
Compare
This is due to the implicit import of the `index.ts` file in a subfolder, if the specific module is not defined. This updates some paths to point to a specific module so that the index.ts is not used. This stops circular dependency issues Signed-off-by: nkomonen-amazon <[email protected]>
karanA-aws
pushed a commit
to karanA-aws/aws-toolkit-vscode
that referenced
this pull request
Jan 17, 2025
## Problem: When we loaded sso cache from disk, we would only invalidate (leading to a reauth prompt) if the cache file was missing. But if the cache file was present, though its content was malformed, we would incorrectly treat it as recoverable by throwing instead of returning undefined. Users would get stuck in a state where all future api calls would fail, and they'd never get a prompt to reauth to fix their SSO session. ## Solution: If we detect a SyntaxError treat it as non-recoverable, meaning it will trigger a reauth. Also added some code to validate the content of the SSO cache we loaded from disk to ensure it is what we expected. Fixes aws#6140 --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Signed-off-by: nkomonen-amazon <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
When we loaded sso cache from disk, we would only invalidate (leading to a reauth prompt) if the cache file was missing.
But if the cache file was present, though its content was malformed, we would incorrectly treat it as recoverable by throwing instead of returning undefined. Users would get stuck in a state where all future api calls would fail, and they'd never get a prompt to reauth to fix their SSO session.
Solution:
If we detect a SyntaxError treat it as non-recoverable, meaning it will trigger a reauth.
Also added some code to validate the content of the SSO cache we loaded from disk to ensure it is what we expected.
Fixes #6140
feature/x
branches will not be squash-merged at release time.License: I confirm that my contribution is made under the terms of the Apache 2.0 license.