Repository navigation
fix: reject "." and ".." as trust store names - #1375
Open
ogulcanaydogan wants to merge 1 commit into
Open
ogulcanaydogan wants to merge 1 commit into
ogulcanaydogan wants to merge 1 commit into
Conversation
IsValidFileName accepted "." and "..", because both match the allowed characters. The named store is joined to the trust store path, so "notation cert delete --type ca --store .. --all" resolved to the x509 directory and removed the trust stores of every type, and "--store ." removed the whole store type directory. The same check guards cert add, show, generate-test and cleanup-test. Reject "." and ".." in IsValidFileName and hoist the regular expression out of the function. Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@gmail.com>
ogulcanaydogan
requested review from
NiazFK,
gokarnm,
priteshbandi,
rgnote,
shizhMSFT,
toddysm,
vaninrao10 and
yizha1
as code owners
October 25, 2026 09:41
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1375 +/- ##
==========================================
+ Coverage 80.10% 80.16% +0.06%
==========================================
Files 68 68
Lines 3076 3076
==========================================
+ Hits 2464 2466 +2
+ Misses 403 402 -1
+ Partials 209 208 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1374.
IsValidFileNameaccepted.and.., sonotation cert delete --type ca --store .. --allresolved to thex509directory and removed the trust stores of every type, and--store .removed the whole store type directory. The same check is used bycert add,show,generate-testandcleanup-test.This rejects
.and..inIsValidFileNameand hoists the regular expression out of the function. The error is the existingnamed store name needs to follow [a-zA-Z0-9_.-]+ format.Tests:
TestIsValidFileNamechecks a table of names, including.,.., names containing dots and path separators.TestCertDelete_DotNamedStoresDoNotTouchOtherStoresrunsdeleteCertswith.and..against a temporary config directory with two stores and checks that it returns an error and the certificates are still there.Both fail without the change.