fix: create storageState directory if it does not exist#1522
Open
Flare576 wants to merge 1 commit intoVersent:masterfrom
Open
fix: create storageState directory if it does not exist#1522Flare576 wants to merge 1 commit intoVersent:masterfrom
Flare576 wants to merge 1 commit intoVersent:masterfrom
Conversation
The Browser provider saves session state to ~/.aws/saml2aws/storageState.json after each login, but never creates the ~/.aws/saml2aws/ directory. If the directory does not exist, context.StorageState() silently fails and the session is never persisted — meaning every login requires full re-authentication including MFA, defeating the purpose of the storageState feature introduced in Versent#1267. Fix: call os.MkdirAll on the directory before attempting to save. Also fixes a pre-existing typo: 'broswer' -> 'browser' in comment. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or 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
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
The
Browserprovider saves session state to~/.aws/saml2aws/storageState.jsonafter each login (introduced in #1267), but never creates the~/.aws/saml2aws/directory first.If the directory doesn't exist,
context.StorageState()fails silently — the error is logged atInfolevel but otherwise swallowed — and the session is never persisted. This means every login requires full re-authentication including MFA, completely defeating the purpose of the storageState feature.Fix
Call
os.MkdirAllon the directory before attempting to save state. If directory creation fails (e.g. permissions), log a warning and continue rather than hard-failing the auth flow.Also fixes a pre-existing typo in a comment:
broswer→browser.How to reproduce the original bug
rm -rf ~/.aws/saml2aws/)saml2aws loginwith Browser provider~/.aws/saml2aws/— directory does not exist, state was never savedsaml2aws loginagain — MFA is required again despite just authenticating