-
Notifications
You must be signed in to change notification settings - Fork 3
fix(config): prevent profile inheritance loops #125
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
base: main
Are you sure you want to change the base?
Conversation
3d26182
to
f84222b
Compare
Seems like your change is breaking tests:
Please ignore PR checks for now - seems perms issue when running on a fork branch 🤦 |
Would you mind rebasing to |
…o prevent infinite loops. First, it adds loop detection for the source_profile chain. This prevents aws-vault from crashing when a profile has a circular dependency on another profile via source_profile. Second, it removes the implicit inheritance of the default profile for all other profiles. This aligns aws-vault's behavior with the AWS CLI and prevents unexpected loops when the default profile has a source_profile set. This was causing a bug where aws-vault would fail to load a valid AWS config.
Replace direct struct instantiation with NewConfigLoader constructor to properly initialize the sourceChain map. This prevents panics when GetProfileConfig tries to assign to the nil map.
Hi @mbevc1, I've rebased onto ByteNess/aws-vault/main.
The NewConfigLoader constructor properly initializes the sourceChain map with make(map[string]bool), preventing the nil map assignment panic that was occurring in vault/config.go:519. |
Thanks for your contribution! I'd like to check the logic here - wouldn't there be some options we'd like to inherit from default, e.g. Side note, would you mind rebasing again, I have new GHA for conventional commit in, which should work better 🤞 |
} else if profileName != defaultSectionName { | ||
err := cl.populateFromConfigFile(config, defaultSectionName) | ||
if err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want to inherit default profile? At least in all non-chained profiles? 🤔
@xilu0 PR checks should be fixed if you rebase to |
Related: #123
This commit introduces two main changes to the config loading logic to prevent infinite loops.
First, it adds loop detection for the source_profile chain. This prevents aws-vault from crashing when a profile has a circular dependency on another profile via source_profile.
Second, it removes the implicit inheritance of the default profile for all other profiles. This aligns aws-vault's behavior with the AWS CLI and prevents unexpected loops when the default profile has a source_profile set. This was causing a bug where aws-vault would fail to load a valid AWS config.
log:
error-debug.log