Repository navigation
Reject '..' path segments in Vault Issuer path fields - #8930
Merged
cert-manager-prow[bot] merged 1 commit intoJun 24, 2026
Merged
cert-manager-prow[bot] merged 1 commit into
cert-manager-prow[bot] merged 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens Vault Issuer configuration by preventing path traversal-like inputs (..) in Vault path fields during webhook validation, and standardizes URL path construction by using path.Join instead of OS-dependent filepath.Join in Vault auth login requests.
Changes:
- Add webhook validation to reject
..inspec.vault.pathand Vault auth mount path fields. - Replace
filepath.Joinwithpath.Joinfor client certificate and Kubernetes auth login URL construction. - Add new validation test cases covering
..rejection for all affected path fields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| internal/vault/vault.go | Switch URL path joining to path.Join for Vault client-certificate and Kubernetes auth login endpoints. |
| internal/apis/certmanager/validation/issuer.go | Add webhook validation rejecting .. in Vault Issuer path fields. |
| internal/apis/certmanager/validation/issuer_test.go | Add unit tests asserting .. is rejected in all relevant Vault path fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wallrj-cyberark
force-pushed
the
vault-path-hardening
branch
from
June 23, 2026 05:49
099551f to
abe2a35
Compare
Reject '..' sequences in spec.vault.path and in the auth mount path fields (appRole.path, kubernetes.path, clientCertificate.path, aws.mountPath) during webhook validation. Go's path.Join resolves '..' segments client-side before constructing the HTTP request to Vault, which can silently produce a different URL than the user intended. For the auth mount path fields, '..' can also escape the hard-coded 'auth/' prefix in the URL construction. Also replace filepath.Join with path.Join in the clientCertificate and kubernetes auth code paths. filepath.Join is OS-dependent and not appropriate for URL path construction. Reported-by: jiayuqi7813 Reported-by: kodareef5 Co-Authored-By: Claude <[email protected]> Signed-off-by: Richard Wall <[email protected]>
wallrj-cyberark
force-pushed
the
vault-path-hardening
branch
from
June 23, 2026 08:01
abe2a35 to
4e38677
Compare
Member
Author
|
/kind bug |
Summary
..sequences inspec.vault.pathand in the Vault authmount path fields (
appRole.path,kubernetes.path,clientCertificate.path,aws.mountPath) during webhookvalidation.
filepath.Joinwithpath.Joinin the clientCertificateand kubernetes auth code paths.
Motivation
Go's
path.Joinresolves..segments client-side beforeconstructing the HTTP request to Vault, which can silently produce a
different URL than the user intended. For the auth mount path fields,
..can also escape the hard-codedauth/prefix in the URLconstruction.
filepath.Joinis OS-dependent and not appropriate for URL pathconstruction;
path.Joinis already used in the AppRole and Sign codepaths.
Thanks to @jiayuqi7813 and @kodareef5 for reporting this.
Why only
..?We considered whether other dangerous characters (
%-encodedtraversal, null bytes, backslashes, newlines, query/fragment
delimiters) need sanitising and concluded that
..is the onlymeaningful vector for these fields. The remaining characters are
already handled by layers below the webhook:
%2e%2e,%2f)url.URL.Path(the decoded field). Go'sURL.String()re-encodes viaEscapedPath(), so a literal%2einPathbecomes%252eon the wire — Vault sees the literal string, not...\x00–\x1f,\x7f)net/url.Parserejects all ASCII control characters at parse time. Even if a control character reached the Vault client's URL construction, the HTTP request would fail.net/urlsection); golang/go#27302; commit 829c5df58694\)path.Joinis POSIX-only and treats\as an ordinary character, not a separator. (We removed the twofilepath.Joincalls that were OS-dependent in this PR.)?,#)url.URLwith the path in the.Pathfield and serialises viaRequestURI(), which percent-encodes these characters. They are never interpreted as delimiters.NewRequest, api/request.gotoRetryableHTTP\r\n)Test plan
TestValidateVaultIssuerConfigandTestValidateVaultIssuerAuthfor..rejection in all path fieldsgo test ./internal/apis/certmanager/validation/...passesgo build ./internal/vault/...confirms clean compilation afterremoving the
path/filepathimport