Skip to content

fix(secret): secret_file_dirs hardening follow-ups - #2032

Open
Dumbris wants to merge 3 commits into
mainfrom
fix/secret-file-dirs-hardening-2031
Open

Dumbris wants to merge 3 commits into
mainfrom
fix/secret-file-dirs-hardening-2031

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 24, 2026

Copy link
Copy Markdown
Member

Refs #2031. Each item was confirmed against main first; tests written red, then fixed.

# Item Result
1 Deny-list depth Fixed. denyPathsAtRead walks the data dir breadth-first: 8 levels, 4096 entries per read, shallow first, secrets/ skipped. Fixed budgets keep the cost independent of data-dir size (bleve segments). Past the budget a file is still refused by path containment and link count; only a post-check path swap onto it goes unmatched.
2 Wildcard race Not real. Identity + link-count are checked on the opened handle in readOpenedSecret for wildcard too (file_policy.go:257,266). Swap test added as a pin; docs sentence corrected.
3 Unresolvable roots Fixed. Missing roots already warned; new warning for a root that is not a directory or cannot be resolved.
4 Doctor finding Fixed. Runtime warning in mcpproxy doctor / GET /api/v1/diagnostics, server names only, scoped callers see their own servers. No contract change (no OAS/Web UI change).
5 CLI save warning Fixed. With no recorder installed the warning prints to stderr (file name only).
6 Dropped secret_file_dirs: [] Fixed. Save refuses (ErrSecretFileDirsUnverified) when the file is undecodable but still shows the key; non-JSON/no-key files stay overwritable.
7 Nil-key case Pinned, no behaviour change. No OAuth override exists in process_overrides.go; read as the missing-entry assertion in runningAPIKeyFromReference (api_key_env.go). Please confirm that was the intended spot.
8 Coverage / Windows Tests added for all of the above. *_windows_test.go run in the Windows unit job (go test ./..., passed on a main run), but that job runs on pushes to main only, not on PRs.

Left unticked in #2031: item 7 (target uncertain) until confirmed.

Checks: go test -race secret/config/runtime/management, scripts/test-api-e2e.sh, golangci-lint bare + --build-tags server (0 new issues), build/vet for windows, linux, server tag.

🤖 Generated with Claude Code

Bounded data-dir identity walk, doctor/diagnostics finding for ${file:} refs
outside the allow-list, startup warning for unusable roots, stderr warning for
standalone CLI saves, refuse saves over an undecodable file holding
secret_file_dirs, pin tests for wildcard swap and the api_key override lookup.

refs #2031

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 976e153
Status: ✅  Deploy successful!
Preview URL: https://3a02d24e.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-secret-file-dirs-hardeni.mcpproxy-docs.pages.dev

View logs

Dumbris and others added 2 commits November 24, 2026 21:59
…reads, case-insensitive key guard

Review round 1 (Sol 6.2): the shared walk budget could starve the state
directories the old walk always compared; os.ReadDir enumerated whole
directories; the undecodable-file guard missed upper-case keys and a file
with a syntax error after the setting.

refs #2031

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s accuracy

Review round 1 (Sol 6.2, chunk 4).

refs #2031

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant