Fixed on branch fix/safe-return-backslash, commit 9920d91, deployed to edge and verified on the process: GET /api/version returns 9920d91.
The check moved ahead of the parse, because the parse is structurally incapable of making it — both spellings are now tested on the raw bytes.
One correction to the issue as I filed it, from watching the test fail. I wrote that url.Parse "leaves both Scheme and Host empty so it passes", which is true, and implied the value then reached the browser as written, which is not. The failure printed:
safeReturn("/\\evil.example.com/") = "/%5Cevil.example.com/"
u.RequestURI() percent-encodes the backslash, so the Location header was a same-origin path all along and no browser was ever sent off-site.
That makes this smaller than "an open redirect, now closed" and worth saying plainly rather than letting the fix imply the scarier version. What was actually wrong: the thing standing between a hostile return value and a redirect was the encoder, not any check in this function. Accidental defence, one refactor from evaporating, and no help at all to a caller who used the raw input instead of the parsed output. The check turns an accident into a decision.
Three cases went into the existing hostile table. One of them — a bare \evil.example.com with no leading slash — passed before the change as well, and it stays as a control so the table cannot be read as three new bugs.
make test green including -race. Closing; not reviewed, per AGENTS.md §Review.