-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: unencoded subpath cannot contain . or .. #368
base: main
Are you sure you want to change the base?
Conversation
supercedes package-url#52 Signed-off-by: Jeremy Long <[email protected]>
I'm wondering if this is actually a good idea. I can agree that the subpath should not contain |
why? i mean, this is already part of the spec:
per spec, the |
Then these tests are wrong, right? They have |
This comment was marked as outdated.
This comment was marked as outdated.
test-suite-data.json
Outdated
"version": "abcdedf", | ||
"qualifiers": null, | ||
"subpath": "googleapis/./api/annotations", | ||
"is_invalid": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets see how the different test scenarios behave:
- passing - parsing the test canonical purl then re-building a purl from these parsed components should return the test canonical purl. there si no way o get this self-fulfilling prophecy
- passed, as the
.
is expected to be stripped - parsing the test purl should return the components parsed from the test canonical purl - passing, as the
.
is expected to be stripped - parsing the test purl then re-building a purl from these parsed components should return the test canonical purl - passing - building a purl from the test components should return the test canonical purl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think also it also fails because the parse succeeds without an error, but is_invalid
indicates that an error is expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revisited the tests. you are right - all test are passing.
will set the is_invalid
from true
to false
test-suite-data.json
Outdated
"version": "abcdedf", | ||
"qualifiers": null, | ||
"subpath": "googleapis/../api/annotations", | ||
"is_invalid": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets see how the different test scenarios behave:
- passing - parsing the test canonical purl then re-building a purl from these parsed components should return the test canonical purl. there si no way o get this self-fulfilling prophecy failing, anyway.
- passed, as the
..
is expected to be stripped - parsing the test purl should return the components parsed from the test canonical purl - passed, as the
..
is expected to be stripped - parsing the test purl then re-building a purl from these parsed components should return the test canonical purl - passing - building a purl from the test components should return the test canonical purl
"name": "genproto", | ||
"version": "abcdedf", | ||
"qualifiers": null, | ||
"subpath": "googleapis/../api/annotations", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be with the ..
or without? If we're using the value as input to verify that formatting removes the ..
, then we want ..
here, but if we're verifying that parsing removes the ..
we wouldn't want it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, but if we're verifying that parsing removes the
..
we wouldn't want it here
The same thing probably confused the original author (and me at first review).
that was the reason i looked up the intended test scenarios.
purl-spec/PURL-SPECIFICATION.rst
Lines 473 to 485 in 65d98c4
To test ``purl`` parsing and building, a tool can use this test suite and for | |
every listed test object, run these tests: | |
- parsing the test canonical ``purl`` then re-building a ``purl`` from these parsed | |
components should return the test canonical ``purl`` | |
- parsing the test ``purl`` should return the components parsed from the test | |
canonical ``purl`` | |
- parsing the test ``purl`` then re-building a ``purl`` from these parsed components | |
should return the test canonical ``purl`` | |
- building a ``purl`` from the test components should return the test canonical ``purl`` |
so there is no case where any result is compared against the test components
.
there are only cases where the test components are used as input and are expected to produce a canonicalized PURL.
Add test cases to check for invalid
.
and..
segments in the subpath.