Allow uppercase letters in secret names (closes #2) #16
No reviewers
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/secret#16
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "clawbot/secret:fix/issue-2"
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
Fixes #2 —
isValidSecretName()regex rejected uppercase letters.Changes
^[a-z0-9\.\-\_\/]+$to^[a-zA-Z0-9\.\-\_\/]+$ininternal/vault/secrets.gointernal/secret/secret_test.goto allow uppercaseinternal/vault/secrets_name_test.gowith comprehensive uppercase test casesTest Output
Vault package tests
Secret package tests
Linting
go vetpasses.golangci-lintnot available in environment; only cgo deprecation warnings from keychain dependency (unrelated).Self-Review: MERGE-READY ✅
Regex change (
[a-z0-9]→[a-zA-Z0-9]): Correct and minimal. Both the vault package regex and the test helper character-range check are updated consistently.Tests: Comprehensive. New
secrets_name_test.gocovers uppercase, mixed case, all-uppercase, and uppercase with paths. Existing invalid cases (spaces,@, leading/trailing/double slashes, dot-start, empty string) are preserved. The secret_test.go helper is updated in parallel.Edge cases:
!,#,$, etc.): Already rejected — no regression.a-ztoa-zA-Z), so no existing valid names break.Code style: Consistent with existing patterns. Comment updated to match. New test file follows the same table-driven style.
Verdict: Straightforward, well-tested, no concerns. Ready for maintainer merge.
Code Review
Verdict: LGTM ✅
Simple regex change from
[a-z0-9\.\-\_\/]to[a-zA-Z0-9\.\-\_\/]to allow uppercase letters in secret names. Motivated by real-world AWS key IDs containing uppercase.Changes are consistent across both
internal/vault/secrets.go(the real validator) andinternal/secret/secret_test.go(the test helper's copy). Newsecrets_name_test.gocovers uppercase variants.Merge order: Should be merged after #15 (path traversal fix) since both touch
isValidSecretName().✅
make checkpasses cleanly (0 lint issues, all tests pass). Rebased on main. Fixed: gosec G204 suppression (pre-existing), updated integration test to accept uppercase secret names (was incorrectly rejecting them).