mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

secret_file_dirs: hardening follow-ups after #1884

Open Dumbris opened this issue 1 week ago • 1 comments

Follow-ups left after #1884 (secret_file_dirs allow-list for upstream ${file:}, closes #1721). None of them blocked the merge; each is a hardening or usability gap found in review.

  • [ ] Deny-list coverage for non-hardlink cases. The identity deny list walks the data directory's top level plus three subdirectories. A sensitive file deeper than that is protected only by the allow-list itself, not by identity.
  • [ ] Wildcard mode (["*"]) race. With the allow-list disabled by wildcard, the check and the open are not bound to one descriptor the way the os.Root path is.
  • [ ] Warn on unresolvable roots. An entry in secret_file_dirs that does not exist or cannot be resolved is skipped silently; it should produce a startup warning naming the entry.
  • [ ] mcpproxy doctor finding. Refs outside the allow-list get a startup WARN only. Add a doctor finding (and the same in GET /api/v1/diagnostics) so it is visible after startup.
  • [ ] Capture-failure warning on standalone CLI saves. When recording the superseded config identity fails, the warning (MsgSupersededConfigNotRecorded) is emitted by the running core but lost on a standalone CLI save.
  • [ ] Unrelated save can drop secret_file_dirs: []. A save triggered by an unrelated edit, from a config whose secret_file_dirs could not be decoded, can write the file back without the key. It should refuse or preserve the raw value.
  • [ ] Nil-key case in internal/config/process_overrides.go (around the OAuth key override): reviewed and judged unreachable today; add a test that pins it.
  • [ ] Test coverage. Patch coverage was about 68% at review time; the Windows identity path (GetFileInformationByHandle, extended-length paths) is exercised only by Windows-tagged tests. Confirm they run in the Windows CI leg and add cases for the items above.

Documented and accepted, no action planned: a hardlink to a log file made after rotation, and the refusal of a benign file with link count > 1 under ScopeUpstream.

Dumbris avatar Nov 24 '26 17:11 Dumbris

All eight items are handled; closing.

  • Items 1, 3, 4, 5, 6: fixed in #2032, each with a test.
  • Item 2 (wildcard race): not a real gap. Identity and link count are checked on the opened handle for wildcard mode too; #2032 added a swap test that pins it and corrected the docs sentence.
  • Item 7 (nil-key case): pinned by a test in #2038, no behaviour change.
  • Item 8 (coverage): tests added with the items above. One limit remains: the *_windows_test.go files run in the Windows unit job on pushes to main only, not on PRs.

The accepted, not-fixed review notes are listed in the #2032 description.

Dumbris avatar Nov 25 '26 16:11 Dumbris