fix(config): only call _secure_file when original permissions were not preserved - #44946
Closed
blut-agent wants to merge 1 commit into
Closed
fix(config): only call _secure_file when original permissions were not preserved#44946blut-agent wants to merge 1 commit into
blut-agent wants to merge 1 commit into
Conversation
…t preserved In save_env_value and remove_env_value, _secure_file() was called unconditionally after os.chmod() restored original permissions, defeating the permission preservation intended for Docker volume mounts and other non-standard file modes. Move _secure_file into the else branch so it only tightens permissions on new files, not when the original mode was successfully restored. Fixes: the _secure_file permission bug pattern documented in references/secure-file-perm-undo-pattern.md
Collaborator
Contributor
Author
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
In
save_env_valueandremove_env_value,_secure_file()was called unconditionally afteros.chmod()restored original file permissions. This defeats the permission preservation intended for Docker volume mounts and other non-standard file modes.The Bug Pattern
The Fix
Move
_secure_fileinto theelsebranch so it only tightens permissions on new files (where no original mode exists), not when the original mode was successfully restored.Files Changed
hermes_cli/config.py—save_env_value()andremove_env_value()Impact
_secure_filepermission bug pattern documented inreferences/secure-file-perm-undo-pattern.md