CodeQL alert (go/unvalidated-url-redirection, medium severity): the dashboard token-exchange handler in internal/webui/auth.go redirected to a Location built directly from the incoming request's path and query, with no validation.
A request whose path starts with // (e.g. GET //evil.example/x?t=<token>) causes clean.RequestURI() to reproduce //evil.example/x verbatim. Browsers treat a Location header starting with // as protocol-relative, so this redirects the client off-host after a legitimate token exchange -- a classic open-redirect via the Go net/url double-slash gotcha.
Fix
Added sameOriginPath() in internal/webui/auth.go, which collapses any leading // down to a single / before the value ever reaches http.Redirect. Covered by a red-then-green test in internal/webui/auth_test.go (TestRequireToken_RedirectRejectsProtocolRelativePath) that reproduces the exploit path and asserts the Location header is never protocol-relative.
Ref: code-scanning alert #4 (dismissed alerts #1-3 on that same scan were false positives -- allocations already bounded by min(), see their dismissal comments).
Imported from beads archie-core-1786637500871-419-5bee4d20 · GitHub #440 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08
CodeQL alert (`go/unvalidated-url-redirection`, medium severity): the dashboard token-exchange handler in `internal/webui/auth.go` redirected to a Location built directly from the incoming request's path and query, with no validation.
A request whose path starts with `//` (e.g. `GET //evil.example/x?t=<token>`) causes `clean.RequestURI()` to reproduce `//evil.example/x` verbatim. Browsers treat a Location header starting with `//` as protocol-relative, so this redirects the client off-host after a legitimate token exchange -- a classic open-redirect via the Go `net/url` double-slash gotcha.
### Fix
Added `sameOriginPath()` in `internal/webui/auth.go`, which collapses any leading `//` down to a single `/` before the value ever reaches `http.Redirect`. Covered by a red-then-green test in `internal/webui/auth_test.go` (`TestRequireToken_RedirectRejectsProtocolRelativePath`) that reproduces the exploit path and asserts the Location header is never protocol-relative.
Ref: [code-scanning alert #4](https://github.com/samcharles93/archie-core/security/code-scanning/4) (dismissed alerts #1-3 on that same scan were false positives -- allocations already bounded by `min()`, see their dismissal comments).
---
_Imported from beads `archie-core-1786637500871-419-5bee4d20` · GitHub #440 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08_
sam
added the mediumbug labels 2026-10-27 13:38:24 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
CodeQL alert (
go/unvalidated-url-redirection, medium severity): the dashboard token-exchange handler ininternal/webui/auth.goredirected to a Location built directly from the incoming request's path and query, with no validation.A request whose path starts with
//(e.g.GET //evil.example/x?t=<token>) causesclean.RequestURI()to reproduce//evil.example/xverbatim. Browsers treat a Location header starting with//as protocol-relative, so this redirects the client off-host after a legitimate token exchange -- a classic open-redirect via the Gonet/urldouble-slash gotcha.Fix
Added
sameOriginPath()ininternal/webui/auth.go, which collapses any leading//down to a single/before the value ever reacheshttp.Redirect. Covered by a red-then-green test ininternal/webui/auth_test.go(TestRequireToken_RedirectRejectsProtocolRelativePath) that reproduces the exploit path and asserts the Location header is never protocol-relative.Ref: code-scanning alert #4 (dismissed alerts #1-3 on that same scan were false positives -- allocations already bounded by
min(), see their dismissal comments).Imported from beads
archie-core-1786637500871-419-5bee4d20· GitHub #440 · type bug · priority P2 · created 2026-08-08 · closed 2026-08-08