fix(config): prevent profile inheritance loops#125
fix(config): prevent profile inheritance loops#125xilu0 wants to merge 2 commits intoByteNess:mainfrom
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.
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 |
|
@xilu0 still working on this? |
|
Hey @xilu0 - still on this one? |
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