Repository navigation
fix(proxy): keep TLS verification for .dev hosts — a public TLD, not local development - #114
Conversation
…local development bin/mcp-proxy.mjs sets rejectUnauthorized = false for "local dev" hosts so a self-signed certificate works, and it sends a WordPress Application Password over that connection. Its list included .dev, which is a delegated public TLD (Google, HSTS-preloaded): a real site at example.dev got a connection with no certificate check, open to a man-in-the-middle for the credential. The host check moves to bin/local-dev-host.mjs (isLocalDevHost) and keeps only names that cannot be a public site: loopback, .test, .localhost, .invalid (RFC 2606/6761) and .local (mDNS). bin/package.json lists the new file. Found by CodeQL js/disabling-certificate-validation (alerts on lines 119 and 154). tests/js/local-dev-host.test.mjs failed on example.dev with the old rule and passes now; a new "Proxy (node --test)" CI job runs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0721246433
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { request as httpRequest } from 'node:http'; | ||
| import { request as httpsRequest } from 'node:https'; | ||
| import { appendFileSync } from 'node:fs'; | ||
| import { isLocalDevHost } from './local-dev-host.mjs'; |
There was a problem hiding this comment.
Preserve the documented standalone proxy installation
For users following the standalone installation instructions in README.md:180, mcp-config-examples.json, or the admin connection page, only mcp-proxy.mjs is copied to the client machine. This new relative import makes that documented workflow exit immediately with ERR_MODULE_NOT_FOUND before processing any MCP requests; copying the changed proxy alone reproduces the failure. Including the helper in the ZIP and npm package does not cover this installation path. Keep the proxy self-contained, or update all standalone installation and upgrade instructions to require copying the helper alongside it.
Useful? React with 👍 / 👎.
Codex r1: the documented standalone install copies only mcp-proxy.mjs, so a relative import of bin/local-dev-host.mjs made it exit with ERR_MODULE_NOT_FOUND. The host check is back inline, with .dev still removed, and the helper module and its unit test are gone. tests/js/proxy-tls.test.mjs now runs the shipped file copied ALONE into an empty directory, against a local HTTPS server with a self-signed certificate, every hostname resolved to it: - mysite.test -> the server answers (and no ERR_MODULE_NOT_FOUND); - example.dev -> no answer: the self-signed certificate is refused. It fails on main (the .dev case) and on the previous commit (the single-file case), and passes here. The CI job is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes the two high CodeQL alerts
js/disabling-certificate-validationinbin/mcp-proxy.mjs(lines 119 and 154).The problem
The stdio proxy sets
rejectUnauthorized = falsefor local development hosts, so that a self-signed certificate works. Over that connection it sends a WordPress Application Password.The local-host list included
.dev. That is a delegated public TLD (Google, HSTS-preloaded), so a real site atexample.devgot a connection with no certificate check, and the credential was open to a man in the middle. The proxy ships in the plugin zip as the connector an operator runs.Fix
bin/local-dev-host.mjs(isLocalDevHost). It keeps only names that cannot be a public site: loopback,.test,.localhost,.invalid(RFC 2606/6761) and.local(mDNS).bin/package.jsonlists the new file underfiles..devsite with a valid certificate keeps working; a.devsite with a self-signed certificate now gets a TLS error, which is correct.Tests
tests/js/local-dev-host.test.mjs(node:test) failed onexample.devwith the old rule (RED,not ok 2) and passes now (3/3).bin/local-dev-host.mjsis in the zip, andtests/stays out of it.CodeQL will probably still flag the conditional
rejectUnauthorized = false, since it cannot see that the condition is now local-only. After merge, if the alerts remain, they are dismissed as "won't fix" with that explanation.🤖 Generated with Claude Code