Repository navigation
feat(mcp): refuse web pages, and never hand over a password column - #680
Merged
Merged
Conversation
Two gaps found by reading the finished feature rather than by a failing test. **Origin.** The endpoint is on loopback behind a token, and a web page cannot read its replies — nothing here sends CORS headers. But DNS rebinding can make a page same-origin with 127.0.0.1, and a request it cannot read is still a request that ran. No harness sends an `Origin` header; a browser always does. So anything carrying one is refused, which is what the MCP spec asks local servers to do and costs nothing. **Credential columns.** Posture answers "how much data", and that is a different question from "which data". Sharing a development database as `full` says you can read it; it does not say you can read the password hashes. A column whose name says credential — password, api_key, ssn, a dozen more — now returns no values at any posture, in `run_select`, in the result already on screen, and in `profile_column`, where a top-ten list of a hash column is that column and a min/max is two of its values. The counts still work, because a count is a number about the data. The redaction is a name match, deliberately: a rule someone can predict from the column name beats one that is right slightly more often. It is not a boundary against a determined agent — `SUBSTRING(password_hash, 1, 10)` still returns — and the module says so. It is a guard against the ordinary case, where nobody intended to hand a credential over. Where something was hidden the answer says which columns and why, because an agent told only "no" tries another way in. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Two gaps found by reading the finished feature rather than by a failing test.
Origin
The endpoint is on loopback behind a token, and a page can't read its replies — nothing here sends CORS headers. But DNS rebinding can make a page same-origin with
127.0.0.1, and a request it cannot read is still a request that ran.No harness sends an
Originheader. A browser always does. So anything carrying one is refused with 403 — which is what the MCP spec asks local servers to do, and it costs nothing. The live Copilot tests still pass, because nothing legitimate sends it.Credential columns
Posture answers "how much data". That's a different question from "which data". Sharing a development database as
fullsays you can read it; it doesn't say you can read the password hashes.A column whose name says credential —
password,api_key,ssn, and a dozen more — now returns no values at any posture:run_selectreplaces the cell with a reason, not a blankget_result_context, is redacted the same way — the user seeing it is not the same as it being allowed to leaveprofile_columngets its counts (a count is a number about the data) but no top-N and no min/max, because a top-ten of a hash column is that column and a min/max is two of its valuesIt's a name match, deliberately: a rule you can predict from the column name beats one that's right slightly more often. It is not a boundary against a determined agent —
SUBSTRING(password_hash, 1, 10)still returns — and the module says so in its first paragraph. It's a guard against the ordinary case, where nobody intended to hand a credential over.Where something is hidden, the answer says which columns and why. An agent told only "no" tries another way in.
Checked
79 tool tests, 9 endpoint tests, 8 for the redaction rules; the three live Copilot tests still pass against the real CLI with the Origin check in place.
🤖 Generated with Claude Code