Skip to content

fix(spector): prevent unauthenticated remote server stop#11274

Merged
timotheeguerin merged 2 commits into
release/july-2026from
fix/spector-stop-loopback
Jul 16, 2026
Merged

fix(spector): prevent unauthenticated remote server stop#11274
timotheeguerin merged 2 commits into
release/july-2026from
fix/spector-stop-loopback

Conversation

@timotheeguerin

@timotheeguerin timotheeguerin commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Hotfix for a reported unauthenticated remote stop vulnerability in @typespec/spector.

The mock server registered POST /.admin/stop with no authentication and bound to all interfaces (0.0.0.0) by default, so any network-reachable client could terminate the server process with a single request.

Fix

The mock server is only ever used locally, so it now always binds to the loopback interface (127.0.0.1). This makes the admin/stop endpoint unreachable from other hosts, which fully closes the reported vector without needing any per-request origin/host check.

Notes

  • Verified with Node's fetch that clients still connect over localhost even on IPv6-first (localhost -> ::1) resolution, so existing localhost-based test workflows keep working.
  • tsp-spector server stop (which posts to http://localhost:<port>/.admin/stop) continues to work unchanged.
  • Added a changelog entry (fix).

Bind the mock server to the loopback interface (127.0.0.1) by default and
reject /.admin/stop requests from non-loopback sources. Adds a --host option
to opt into binding on all interfaces (e.g. 0.0.0.0 inside a container).
@microsoft-github-policy-service microsoft-github-policy-service Bot added the spector Issues related to spector and the spec sets label Jul 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/spector@11274

commit: 870149d

@azure-sdk-automation

azure-sdk-automation Bot commented Jul 16, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin
timotheeguerin marked this pull request as ready for review July 16, 2026 17:05
The mock server now always binds to 127.0.0.1, so the unauthenticated
/.admin/stop endpoint is unreachable from other hosts. This removes the
need for the --host option and the per-request loopback check.
@timotheeguerin
timotheeguerin enabled auto-merge (squash) July 16, 2026 21:56
@timotheeguerin
timotheeguerin merged commit 30d6f65 into release/july-2026 Jul 16, 2026
26 checks passed
@timotheeguerin
timotheeguerin deleted the fix/spector-stop-loopback branch July 16, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spector Issues related to spector and the spec sets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants