fix(#32,#35): chmod 600 MCP config files, scrub secrets from export#52
Merged
fix(#32,#35): chmod 600 MCP config files, scrub secrets from export#52
Conversation
- #32: Apply os.chmod(path, 0o600) to all MCP server JSON config files written by Claude, Cursor, Gemini, Windsurf, and Copilot appliers. Secrets are still resolved (tools need them to work) but access is restricted to the file owner. sync_mcp() now emits a warning when servers with secret_placeholders are about to be written to disk. - #35: Add scrub_content() to secrets_manager.py using regexes to detect common API-key/token patterns and replace them with [REDACTED]. export_cmd() calls scrub_content() on every skill body and memory content entry before writing the export archive. - Add .gitleaks.toml to allowlist test file that tests scrubbing logic. Test values are built at runtime (not literal) to avoid false positives. Tests: 11 new tests in test_security_secret_handling.py.
79b3e31 to
d61a246
Compare
forge-fz2000
added a commit
that referenced
this pull request
Mar 9, 2026
… diff Removed incorrectly listed items that are NOT in main: - apc skill remove / apc unsync (PR #72 was merged into a feature branch, not main) - Windsurf/Copilot native sync support (same) - --target/-t removal from apc install (same) Added missing items that ARE in main since v0.1.1: - Security fixes: input validation, chmod 600 MCP configs, scrub secrets from export (#27,#28,#30 via #50; #32,#35 via #52) - Bug fixes: LLM write guard, expanduser paths, Copilot absolute paths (#37,#38-#43,#42 via #53; #36,#45 via #54) - Fix: ~/.apc/skills/ always created after apc install - Fix: --version reads from importlib.metadata - Docs: README shell completion, CLI basics (#23,#26 via #67)
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.
Fixes #32, Fixes #35
#32 — MCP sync writes resolved secrets to plaintext tool config files
All MCP server JSON config files written by appliers (Claude, Cursor, Gemini, Windsurf, Copilot) are now set to chmod 600 immediately after write. Secrets are still injected so tools can start MCP servers, but access is restricted to the file owner. sync_mcp() now emits an explicit warning when servers with secret placeholders are being resolved and written to disk.
#35 — Memory and skill content exported in plaintext without secret scrubbing
Added scrub_content() to secrets_manager.py using regexes to detect common API-key/token patterns (OpenAI sk-, Anthropic sk-ant-, GitHub ghp_/ghs_, JWTs, long base64 blobs). export_cmd() calls scrub_content() on every skill body and memory content entry before writing the export archive.
Tests
11 new tests in test_security_secret_handling.py: