fix: reject client CN containing path separator (#31) #37
No reviewers
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!37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/31-reject-cn-path-separator"
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?
Fixes #31.
Summary
empty CN, leading/trailing dot, and other unsafe characters via the same
regex used for domain names elsewhere.
stays free of attacker-controlled input (relates to #29).
Test plan
sub/inner, sub\inner, NUL, empty, leading dot.
still pass (no regression on the happy path).
(co)authored by ai (claude-opus-4-7)
internal/list/validate_fuzz_test.go: FuzzValidateClientName. The asserted invariants are orthogonal to the validator's implementation, so a regression cannot pass by accident: - every failure must wrap ErrInvalidName (errors.Is) - any input ValidateClientName accepts must also be accepted by ValidateDomain (ValidateClientName is strictly stricter) A 20s run with 8 workers reaches ~1.1M execs without finding a violation; the seed corpus carries every interesting case from TestCnList_RejectsUnsafeName. cmd/cert-proxy-server/server_test.go: two new behavioural tests at the HTTP boundary, distinct from the function-level checks: - TestServe_ListInvalidCN — /v1/list with a malformed CN returns 401 (not 500), and the response body does not echo the attacker-controlled CN - TestAuthz_InvalidCN body assertion — same no-echo guarantee extended from the err.Error() level to the actual w.Body These guard the path that auth.go and serve.go take when cnList returns ErrInvalidName.