Repository navigation
fix: set 0700 on credential config parent dir (completes #112) - #215
Open
juliasadler wants to merge 1 commit into
Open
juliasadler wants to merge 1 commit into
juliasadler wants to merge 1 commit into
Conversation
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.
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
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 aftermkdirinsave_config(). An explicitchmod(rather thanmkdir(mode=...)) also hardens directories that already exist, sincemkdirignoresmodewhen combined withexist_ok=True.tests/test_config_migration.py: assert the parent dir mode is 0o700 aftersave_config().CONTRIBUTING.md: document the 0700 directory requirement in the Security section.Verification
python3 -m unittest test_config_migration— OK (also rantest_credentials, 9 tests OK).CONFIG_PATHto 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