Repository navigation
Conversation
… added The file is only rewritten when a new server is added, so a user whose older secfoo left it at 0644 kept a world-readable file on every re-run where all servers were already configured -- the usual upgrade path. chmod it to 0600 in that case too (POSIX only; an OSError never fails the sync). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for this, and for the clear write-up and the parametrized test for both the new-file and existing-0644 cases. Using I pushed one small follow-up commit (ec2166b) to your branch rather than asking for another round. The file is only rewritten when a new server is added. A user whose older secfoo already left Once CI is green this is ready to merge. Thanks again, and we'd be glad to see more from you. |
Leaderboard update
nabeelbaghoor now has 3 points (rank #12). 22 more to reach Bronze. |
Closes #171
What does this change, and why?
secfoo mcp sync --agent agentwrote~/.cursor/mcp.jsonwithPath.write_text, so a new file got the process umask (usually0644) and an existing0644file stayed world-readable. The file carries each server'senvandheaders, which usually hold secrets (thesecfoo-memorybearer key, Jira or Confluence tokens).sync_cursornow writes the file withconfig.write_private_text, the same helperwrite_claude_mcp_configuses. It creates the file as0600and tightens an existing file withfchmodbefore writing, so there is no window where the secrets are readable by others. On Windows, wherefchmoddoes not exist, the helper skips that step, so the sync does not fail there.Testing
pytest testspasses (see below: no new failures)ruff check .passes (see below: clean on the changed files)Added/updated tests for the behavior change
New
test_sync_cursor_writes_config_owner_only(POSIX only, skipped on Windows), parametrized for a new file and for an existing file at0644: both fail onmain(mode0644) and pass with this change.pytest tests/test_mcp.py tests/test_store_privacy.py: 26 passed.pytest tests: 1920 passed, 12 failed. The same 12 tests fail on an untouched checkout ofmainin my environment (mermaid vendoring and CLI environment tests such astest_architecture_dashboard.pyandtest_cli_assessment.py), none of them touch MCP sync.ruff check src/secfoo/mcp.py tests/test_mcp.py: clean.ruff check .with ruff 0.17.6 reports 143 findings in files this PR does not touch, the same count as onmain.