Skip to content

fix(#32,#35): chmod 600 MCP config files, scrub secrets from export#52

Merged
FZ2000 merged 1 commit intomainfrom
fix/security-secret-handling-32-35
Mar 8, 2026
Merged

fix(#32,#35): chmod 600 MCP config files, scrub secrets from export#52
FZ2000 merged 1 commit intomainfrom
fix/security-secret-handling-32-35

Conversation

@FZ2000
Copy link
Owner

@FZ2000 FZ2000 commented Mar 8, 2026

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:

  • scrub_content() detects/redacts OpenAI, Anthropic, GitHub token patterns
  • Plain text and short base64 are not affected
  • chmod 600 verified on Claude, Cursor, Gemini appliers
  • sync_mcp() emits a warning when servers have secret_placeholders

- #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.
@FZ2000 FZ2000 force-pushed the fix/security-secret-handling-32-35 branch from 79b3e31 to d61a246 Compare March 8, 2026 02:12
@FZ2000 FZ2000 merged commit f764046 into main Mar 8, 2026
5 checks passed
@FZ2000 FZ2000 deleted the fix/security-secret-handling-32-35 branch March 8, 2026 02:13
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant