Repository navigation
Decide "this computer only" from the connection's local address - #47
Merged
Merged
Conversation
Check Client Access.vi decides "this computer only" from the client's reverse-DNS name, which whoever controls the PTR record can choose. The local address of the TCP connection cannot be chosen that way: a connection whose local address is 127.x arrived over loopback. MCP Connection Probe.lvclass (private, Webserver folder) inherits from IG's Stream-TCP TCP Client class so that its static member Connection Local IP.vi may call the protected Get TCP Connection on the connection IG hands to the handler, and returns NI's TCP Get Local IP result. No DNS lookup is made. Nothing calls it yet; the access check switches to it in the next commit. Measured in LabVIEW 2026 64-bit: 127.0.0.1 over loopback, the LAN IP over the LAN IP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With Allowed clients empty, a client counted as this computer when its reverse-DNS name started with "127.", was "localhost", "::1" or one of this computer's names. Whoever controls the PTR record of their address can choose such a name, so a remote client could pass the default filter and, with no token set, call every tool. Check Client Access.vi takes a new input, local IP, and grants the local-only mode only when the connection's local address starts with "127." - a connection to 127.x arrived over loopback, which a remote peer cannot produce. An empty local IP (the probe failed) is refused. Process HTTP Request.vi reads it with Connection Local IP.vi; a probe error only leads to 403, never to a 500. "*" and explicit entries are unchanged and still compared with the reported host name, which stays best effort: use the access token for remote clients. A local client that connects through this computer's LAN address is now refused in local-only mode; list it or use 127.0.0.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Start.vi stored the token and allowed clients in parallel with opening the HTTP server, so the first requests could be checked against empty settings, and it registered the server before opening the port: when Open failed (port in use, error 5001) the half-built server stayed in the server list and its id was returned as if it were valid. Start.vi now stores the access settings in the error chain before Open and, when any step after registering fails, calls Stop.vi and returns server id -1 with the original error. Stop.vi now also clears the server's stored token and allowed clients. Start.vi's description has the right default URL (port 36987) and documents both. Measured: with the port held by another listener, Start returns -1 and error 5001. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The handler's path regex was "<url>[^/]*" with no anchors, so /x/mcp/server and /mcp/serverABC also reached the MCP server, and a url with regex metacharacters matched the wrong paths. Get Path Regex.vi now builds ^\Q<url>\E/?(?:[?#].*)?$: the url quoted literally, an optional trailing slash, query and fragment allowed. Measured against IG's router: /mcp/server and /mcp/server?x=1 match; /mcp/serverABC, /x/mcp/server and /mcp/server/anything get IG's 404. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its description had been copied from Get Parameter.vi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The readme said "this computer" is recognised by host names and that the token is the protection, but not how a client sends the token, that the transport has no TLS, or that an Origin header from another host is refused even with "*". It now says local-only access is decided by the connection's address, that host-name entries are a convenience and need a token, the order of the checks, the Origin rule, the missing TLS, and shows the token header for mcp-remote and Claude Code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests✅ All 64 tests passed. Per-test results
Protocol tests✅ Protocol tester output (0 failed required checks)VI changesVIs: 7 modified, 1 added, 0 deleted Report for commit 4233961. The installable test package is under Artifacts of this run once the build job has finished. |
JanGoebel
marked this pull request as ready for review
October 30, 2026 19:22
This was referenced Oct 30, 2026
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.








Summary
With Allowed clients empty, the server is meant to accept only this computer. It decided that from the client's reverse-DNS name, which anyone who controls the PTR record of their address can choose, so a remote client could pass the default filter and, with no token set, call every tool. The check now uses the local address of the TCP connection, which a remote peer cannot fake. The same branch closes three smaller gaps: Start stores the access settings before the port opens, a failed Start no longer leaves a half-built server behind, and the handler matches only its own path.
127.*,localhost,::1or a name of this computer127.(arrived over loopback); probe failure → 403127.0.0.1-1, original error/x/mcp/server,/mcp/serverABC*and explicit host-name entries are unchanged and still best effort: use the access token for remote clients.Changes
MCP Connection Probe.lvclass(new, private, Webserver folder): inherits from IG's Stream-TCP TCP Client so its static member can call the protected Get TCP Connection on the connection IG hands to the handler.Connection Local IP.vi(new): returns NI's TCP Get Local IP for that connection. No DNS lookup.Check Client Access.vi(modified): new input local IP. Local-only mode is granted only when it starts with127.; an empty local IP is refused.Process HTTP Request.vi(modified): reads the local IP with Connection Local IP.vi and passes it on; a probe error leads to 403, never 500.Start.vi(modified): stores token and allowed clients in the error chain before Open; when any step after registering fails, calls Stop.vi and returns-1with the original error. Description now gives the right default URL (port 36987).Stop.vi(modified): also clears the server's stored token and allowed clients.Server Access Settings.vi(modified, in the local-address commit2b81231): the commit message does not say what changed here; the diff report will show it.MCP Handler/Get Path Regex.vi(modified): builds^\Q<url>\E/?(?:[?#].*)?$: url quoted literally, optional trailing slash, query and fragment allowed.Get Server Name from ID.vi(modified): description only; it had been copied from Get Parameter.vi.MCP Server.lvlib: the new class as a member.readme.md: how local-only access is decided, that host-name entries need a token, the order of the checks, the Origin rule (another host is refused even with*), that the transport has no TLS, and the token header for mcp-remote and Claude Code.Code summary
To follow once the review report with the VI diff is posted.
Verified
Measured in LabVIEW 2026 64-bit while the changes were made (from the commit messages):
127.0.0.1over loopback and the LAN IP over the LAN IP.-1and error 5001./mcp/serverand/mcp/server?x=1match;/mcp/serverABC,/x/mcp/serverand/mcp/server/anythingget 404.Not verified
-1, path matching). They are the reason this is a draft.::1) is not treated as local; not tested whether IG accepts IPv6 at all.Known rough edges
🤖 Generated with Claude Code