Skip to content

fix: set 0700 on credential config parent dir (completes #112) - #215

Open
juliasadler wants to merge 1 commit into
titanwings:dot-skillfrom
juliasadler:fix/credential-file-permissions
Open

juliasadler wants to merge 1 commit into
titanwings:dot-skillfrom
juliasadler:fix/credential-file-permissions

Conversation

@juliasadler

Copy link
Copy Markdown

Problem

save_config() in the auto-collectors writes credential files with mode 0600 (already in place on the default branch), but the parent config directory (~/.distilly/) is created without restrictive permissions — typically 0755 from umask — leaving directory listing/traversal open to other local users.

Fix

  • tools/feishu_auto_collector.py, tools/slack_auto_collector.py, tools/dingtalk_auto_collector.py, tools/feishu_mcp_client.py: CONFIG_PATH.parent.chmod(0o700) right after mkdir in save_config(). An explicit chmod (rather than mkdir(mode=...)) also hardens directories that already exist, since mkdir ignores mode when combined with exist_ok=True.
  • tests/test_config_migration.py: assert the parent dir mode is 0o700 after save_config().
  • CONTRIBUTING.md: document the 0700 directory requirement in the Security section.

Verification

  • python3 -m unittest test_config_migration — OK (also ran test_credentials, 9 tests OK).
  • Manual script under umask 022: patched CONFIG_PATH to temp dirs for all four modules, asserted file 0600, parent dir 0700, content intact; also verified a pre-existing 0755 dir is tightened to 0700. 8/8 passed.

Note: the Confluence collector mentioned in the issue does not exist yet (PR #106 is still open), so there is nothing to change there.

Closes #112

Completes the remaining acceptance criteria of titanwings#112:
- set 0700 on the ~/.distilly/ parent dir in save_config()
  (feishu/slack/dingtalk auto-collectors and feishu_mcp_client)
- assert parent dir mode in test_config_migration.py
- document the 0700 requirement in CONTRIBUTING.md (Security)

The 0600 file mode was already in place on the default branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden credential file permissions across all auto-collectors

1 participant