serve.go: validate URL-derived domain (defense in depth, Windows considerations) #38
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
mod-nag
mod-nag
mod-nag
mod-nag/ignore
mod-nag/ignore
mod-nag/ignore
nagonag
nagonag/ignore
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
heiko/cert-proxy#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up from #31 / PR #37. User confirmed filing in the working session.
The CN from the X.509 subject is now validated in cnList via list.ValidateClientName (PR #37). The other attacker-controlled string used as a filename — the URL-derived domain in serve.go — is not, and currently relies on layered defenses:
Today the combination is sufficient. The concern is brittleness: any of these defenses could be lost in a refactor (e.g. switching to http.ServeMux PathValue or net/url RawPath handling), and the validator gap would silently re-open the same class of bug as #31.
Proposed change
Validate domain with list.ValidateDomain in serve.go right after extraction, covering /v1/cert, /v1/chain, /v1/fullchain, /v1/privkey, /v1/bundle.
ValidateClientName (introduced in #37) is too strict here — it rejects * which is needed for wildcard certs retrievable by URL (/v1/cert/*.example.com). ValidateDomain is the right choice for the URL-derived domain.
Windows-specific considerations
Official builds target linux/amd64 and linux/arm64 via gogogo, but go build on Windows works:
Why low priority
No live exploit vector identified on Linux or Windows. Hardening against a refactor that might re-open the door.
Related
(co)authored by ai (claude-opus-4-7)
AI attribution comment added per repository instruction for this open issue.\n\n(co)authored by ai:gpt-5-codex