Bug: GetSecret/GetSecretVersion missing name validation allows path traversal #13
Labels
No Label
merge-ready
merge-ready
needs-checks
needs-checks
needs-rebase
needs-rebase
needs-review
needs-review
needs-rework
needs-rework
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/secret#13
Loading…
Reference in New Issue
Block a user
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?
Summary
AddSecretvalidates names viaisValidSecretName(), butGetSecretandGetSecretVersionininternal/vault/secrets.godo not validate thenameparameter before constructing filesystem paths.Impact
An attacker (or malformed input) could pass
../../etc/passwdas a secret name. The/→%replacement would prevent literal directory traversal, but..is not blocked. A name like..%2F..%2Fetc%2Fpasswdafter round-tripping could cause unexpected behavior. More practically, names with..components that don't contain/(e.g...) would directly traverse.Fix
Call
isValidSecretName(name)at the top ofGetSecretVersion(whichGetSecretdelegates to). Return an error for invalid names.Location
internal/vault/secrets.go—GetSecretVersion()around line 10-40