Skip to content

feat(mcp): refuse web pages, and never hand over a password column - #680

Merged
EVWorth merged 1 commit into
mainfrom
fix/agent-origin-check
Sep 12, 2026
Merged

EVWorth merged 1 commit into
mainfrom
fix/agent-origin-check

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 12, 2026

Copy link
Copy Markdown
Owner

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 Origin header. 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 full says 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_select replaces the cell with a reason, not a blank
  • the result already on screen, through get_result_context, is redacted the same way — the user seeing it is not the same as it being allowed to leave
  • profile_column gets 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 values

It'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

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]>
@EVWorth
EVWorth merged commit b7f6287 into main Sep 12, 2026
12 checks passed
@EVWorth
EVWorth deleted the fix/agent-origin-check branch September 12, 2026 23:45
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