registry/internal/api/handlers/v0/auth
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Radoslav Dimitrov 1201cbd82b
security: fix open redirect and add small hardening (#1227)
## What this does

Fixes an open redirect plus a handful of small, mostly-invisible
hardening changes around it.

## What's in it

- **The fix**: trailing-slash redirects no longer let `//evil.com/`
redirect off-host.
- **SSRF block** on the DNS/HTTP namespace verification — refuses to
dial loopback, RFC1918, link-local, multicast, CGNAT, or
IP-literal/single-label \"domains\".
- **Slow-client guard**: `ReadTimeout` and `IdleTimeout` on the HTTP
server (no `WriteTimeout` — would risk cutting off legitimate
multi-package publishes).
- **Defence-in-depth headers** on the UI (`/`) and 404 responses.
- **5xx responses** stop leaking raw DB error text to clients (logged
server-side instead).
- **Search filter** stops treating `%` and `_` as wildcards.
- **Validators**: PyPI/NuGet identifiers URL-escaped before fetching;
MCPB no longer follows redirects.
- **Misc**: `Version` field bounded to 255 chars; logs quote user input;
`BlockedNamespaces` denylist now catches subdomain claimants.

Each change is its own commit so they can be reviewed (or reverted)
independently.

## Test plan

- [ ] CI green
- [ ] Synthetic publish in staging for each package type (npm, pypi,
nuget, oci, mcpb) — confirms validator changes don't regress
- [ ] Quick browser check of `/` after deploy to confirm UI still loads
with the new CSP
- [ ] `curl https://<host>//evil.com/` — confirm the open redirect is
closed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 19:14:00 -04:00
..
common.go security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
common_test.go security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
dns.go fix(auth): better DNS verification errors and wrong-selector hint (#1202) 2026-04-25 11:22:06 -04:00
dns_test.go security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
github_at.go Replace / with - for operation IDs (#660) 2025-10-14 15:26:43 +03:00
github_at_test.go Deduplicate server JSON structs between publisher and registry (#318) 2025-08-28 14:58:15 +01:00
github_oidc.go Replace / with - for operation IDs (#660) 2025-10-14 15:26:43 +03:00
github_oidc_test.go Deduplicate server JSON structs between publisher and registry (#318) 2025-08-28 14:58:15 +01:00
http.go security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
http_internal_test.go security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
http_test.go security: fix open redirect and add small hardening (#1227) 2026-04-29 19:14:00 -04:00
main.go Introduce v0.1 version of the API (#658) 2025-10-14 11:04:48 +03:00
none.go Replace / with - for operation IDs (#660) 2025-10-14 15:26:43 +03:00
none_test.go Changes on the server.json format and the API (#562) 2025-09-29 23:30:35 +03:00
oidc.go Replace / with - for operation IDs (#660) 2025-10-14 15:26:43 +03:00
oidc_test.go Stop pinning Go to patch versions, use stable in CI (#1137) 2026-04-09 11:57:21 -04:00