fix: usable IPv6 spelling, and drop a SEP label that means something else here (round 2)

- The recovery text told users to move the endpoint to `::1`. A bare IPv6
  literal is not a legal URL host — `new URL("http://::1/token")` throws — so
  anyone copying that into the Token URL override got a parse error from advice
  meant to unblock them. Now `[::1]`, in both the notice and the manual
  reproduction guide.

  The exemption list still reads `::1`, because that is the host the SDK
  compares; only the remedy is bracketed, because that is what a user types.
  The comment says so, so neither gets "corrected" into the other.

- Dropped SEP-2207 from all nine files it had reached. I took the label from
  the SDK's own source comments, which attribute this check to it — but this
  repo already uses SEP-2207 for OIDC refresh / offline_access
  (specification/v2_auth_hardening.md, plus an e2e test), so grepping it here
  would have turned up two unrelated things. Replaced with plain description
  rather than a different SEP number: having guessed wrong once, guessing again
  is not the fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MvNbmAtQuWhDvzi4yXDju
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-07 09:54:17 -04:00
commit 084a083e2d
2 changed files with 30 additions and 21 deletions

View file

@ -1,5 +1,5 @@
/**
* SEP-2207: the SDK refuses to send credentials to a non-TLS token endpoint
* The SDK refuses to send credentials to a non-TLS token endpoint
* whose host is outside its loopback exemption (`localhost` / `127.0.0.1` /
* `::1`), throwing `InsecureTokenEndpointError` from inside
* `executeTokenRequest`.

View file

@ -364,7 +364,7 @@ export function reAuthBannerMessage(options: {
}
/**
* Heading for the SDK's SEP-2207 refusal to post credentials to a non-TLS token
* Heading for the SDK's terminal token-endpoint refusal to post credentials to a non-TLS token
* endpoint (#2280).
*
* Deliberately not phrased as an authentication failure. Like
@ -389,6 +389,12 @@ export function insecureTokenEndpointTitle(): string {
* legitimately sent earlier in the session, and a user who had been connected
* for an hour would rightly read it as describing a different failure.
*
* The exemption is listed as `::1` (that is the host the SDK compares) but the
* remedy says `[::1]`, because that is what a user must actually type: a bare
* IPv6 literal is not a legal URL host and `new URL("http://::1/token")`
* throws. The two spellings are deliberately different — do not "fix" either
* into the other.
*
* The section name is the one the UI actually renders — **OAuth Settings**,
* with a **Token URL override** field — not "Authorization". Sending someone to
* a settings section that does not exist is the worst possible error in the one
@ -418,8 +424,8 @@ export function insecureTokenEndpointMessage(options: {
`its token endpoint ${truncateUrlForDisplay(options.tokenEndpoint)} is ` +
"not HTTPS, and its host is outside the MCP SDK's loopback exemption, " +
"which covers only localhost, 127.0.0.1 and ::1. Re-authenticating cannot " +
"change this. Serve the token endpoint over HTTPS, or move it to one of " +
"those three spellings — Server Settings → OAuth Settings has a " +
"change this. Serve the token endpoint over HTTPS, or move it to " +
"localhost, 127.0.0.1 or [::1] — Server Settings → OAuth Settings has a " +
'"Token URL override" if the authorization server advertises a different ' +
"one."
);