Repository navigation
mcp-startup-config-validation-and-credential-redaction - #835
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
72ad1df to
3934b2c
Compare
| } | ||
| if config.Server.Transport == "" { | ||
| config.Server.Transport = mcpServerType | ||
| if config.Server.Transport == "" { |
There was a problem hiding this comment.
this is not needed
There was a problem hiding this comment.
This does not belong in the cmd package. Please move this functionality to a dedicated pacakge with abstraction, behaviour differentiated at contruction, contrived example:
diagnoser := diagnostics.NewMcpServerDiagnoser(...)
diagnosis, diagnosisErr := diagnoser.Diagnose()
...
Fuzzes the MCP server built from the pull request with the published stackql/mcp-wringer@v0 Action on each platform the project ships (linux amd64 and arm64, darwin amd64 and arm64, windows amd64, and the amd64 exe under emulation on windows-11-arm) in every server mode the fuzzer can drive: stdio at 2025-11-25, stdio pinned to 2026-07-28, Streamable HTTP stateful at 2025-11-25, and Streamable HTTP stateless at 2026-07-28. The server runs hermetically with a throwaway approot, the repository's file:// registry, audit off and no credentials. cicd/mcp-wringer/mcp-server.mjs owns the server invocation: it emits the Action's command and args, and starts and stops the detached HTTP servers with a readiness wait. Reports and reproducers are uploaded as artifacts per platform. Verified locally on Windows amd64 with the published 0.1.0 package: all four modes are clean at the standard profile (256 cases over HTTP; stdio was capped by the profile's 120 s budget at 197 cases, so the workflow raises MCP_WRINGER_DURATION_MS so every platform runs the same 256 cases). A stateful server fuzzed as a 2026-07-28 client is rejected with -32022 and is not a fuzzable mode. actionlint 1.6.23 passes. Not verified: the non-Windows runners, which the pull request run will exercise. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Reject malformed MCP configuration before either
mcporsrvexposes listeners or tools. Both entrypoints now require an inline JSON object, reject unknown fields and decoding/validation errors, and return an error without echoing the configuration. Legacyread_onlyand tool restrictions remain effective.Sanitize a diagnostic copy of registered startup arguments using the field and URL rules in #825. Preserve environment/file references, ordinary registry URLs, Jsonnet variables, usernames and sibling settings. Mask inline credentials, DSNs, OTLP header values and TLS key contents. Startup masking lives in
internal/stackql/diagnosticsbehindDiagnoser, with the policy selected byNewMCPServerDiagnoser. The implementation is private; no new DTOs or mutable configuration carriers are introduced.Authentication, reload, queries, flag precedence and stdio session lifetime are unchanged. #828 is excluded.
Type of change
Issues referenced
Closes #824
Closes #825
Evidence
bb0aeb4, including platform builds, full robot runs, Docker SQLite/PostgreSQL shards, shard verification, lint, CodeQL and GitGuardian. Build run.CGO_ENABLED=0 python cicd/python/build.py --buildpassed with Go 1.25.3.python cicd/python/build.py --testpassed; affected packages also passed after final edits.Checklist
Variations
Local build/unit/robot checks ran on Windows; CI-pinned lint ran under Linux/WSL. Full platform and database coverage passed in CI on the review update.
Diagnostic configuration is reserialized; flag aliases are shown by their registered names. Unknown options and positional payloads are omitted. This does not sanitize all application errors: an existing malformed
--authDTO error can echo a short value before the startup diagnostic (#816 scope). No arbitrary-string secret detection is added.Tech Debt
No new deferred work. Inline-auth policy changes and request deadlines remain separate issues.