Merge PR #757: security: enforce 0600/0700 file permissions on sensitive files
Enforces owner-only permissions on files containing secrets: - config.yaml, .env → 0600 - ~/.hermes/, cron dirs → 0700 - cron jobs.json, output files → 0600 Windows-safe (all chmod calls wrapped in try/except). Inspired by openclaw v2026.3.7.
This commit is contained in:
commit
6e303def12
4 changed files with 190 additions and 6 deletions
6
cli.py
6
cli.py
|
|
@ -1060,6 +1060,12 @@ def save_config_value(key_path: str, value: any) -> bool:
|
|||
with open(config_path, 'w') as f:
|
||||
yaml.dump(config, f, default_flow_style=False, sort_keys=False)
|
||||
|
||||
# Enforce owner-only permissions on config files (contain API keys)
|
||||
try:
|
||||
os.chmod(config_path, 0o600)
|
||||
except (OSError, NotImplementedError):
|
||||
pass
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error("Failed to save config: %s", e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue