Report '.' and '..' path segments in namespace and name as invalid - #233
Open
MGpromax wants to merge 1 commit into
Open
Report '.' and '..' path segments in namespace and name as invalid#233MGpromax wants to merge 1 commit into
MGpromax wants to merge 1 commit into
Conversation
The recovering parser accepts purls such as pkg:golang/busybox.org/../busybox@1.35.0 and reports 'busybox.org/..' as the namespace. Following the direction in issue package-url#228, keep parsing permissive and instead report these from the validation API: a '.' or '..' segment in the namespace, or as the name, now yields an ERROR ValidationMessage from validate() and validate_string(). Closes package-url#228 Signed-off-by: Manoj Gowda <manojgowdabs18@gmail.com>
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.
Closes #228
Following the direction discussed in #228 and #229 --
from_string()stays a recovering parser and validation lives in the validation API -- this adds ERROR-severityValidationMessages when a purl's namespace contains a.or..path segment, or when the name itself is.or..:Names or namespace segments that merely contain dots (
example.com,my..pkg) are unaffected. The checks live in the base type-definition validator so they apply to every purl type.Full test suite passes with the purl-spec submodule test corpus (988 passed), plus three new tests covering the namespace case, the name case, and the non-regression on dotted names.