-
Notifications
You must be signed in to change notification settings - Fork 3k
reject path-traversal segments in coordinate ids and versions #12410
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
Open
jmestwa-coder
wants to merge
3
commits into
apache:master
Choose a base branch
from
jmestwa-coder:coordinate-path-traversal
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+269
−0
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
c56ab89
[#12427] reject path-traversal segments in coordinate ids and versions
jmestwa-coder c8ac7a0
[#12427] add test coverage for single-dot and groupId path-traversal …
jmestwa-coder 1c0b584
[#12427] reword javadoc: rejection is due to the path mapping, not th…
jmestwa-coder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
34 changes: 34 additions & 0 deletions
34
...odel-builder/src/test/resources/poms/validation/coordinate-ids-path-traversal-dot-pom.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>..</groupId> | ||
| <artifactId>.</artifactId> | ||
| <version>1.0</version> | ||
| <packaging>jar</packaging> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>other.group</groupId> | ||
| <artifactId>lib</artifactId> | ||
| <version>.</version> | ||
| <type>jar</type> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
34 changes: 34 additions & 0 deletions
34
...en-model-builder/src/test/resources/poms/validation/coordinate-ids-path-traversal-pom.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>test.group</groupId> | ||
| <artifactId>..</artifactId> | ||
| <version>1.0</version> | ||
| <packaging>jar</packaging> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>other.group</groupId> | ||
| <artifactId>lib</artifactId> | ||
| <version>..</version> | ||
| <type>jar</type> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
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
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
34 changes: 34 additions & 0 deletions
34
impl/maven-impl/src/test/resources/poms/validation/coordinate-ids-path-traversal-dot-pom.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>..</groupId> | ||
| <artifactId>.</artifactId> | ||
| <version>1.0</version> | ||
| <packaging>jar</packaging> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>other.group</groupId> | ||
| <artifactId>lib</artifactId> | ||
| <version>.</version> | ||
| <type>jar</type> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
34 changes: 34 additions & 0 deletions
34
impl/maven-impl/src/test/resources/poms/validation/coordinate-ids-path-traversal-pom.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| <project> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>test.group</groupId> | ||
| <artifactId>..</artifactId> | ||
| <version>1.0</version> | ||
| <packaging>jar</packaging> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>other.group</groupId> | ||
| <artifactId>lib</artifactId> | ||
| <version>..</version> | ||
| <type>jar</type> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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 don't think this is true. The problem is mapping straight into a path traversal segment, not that these are the names. If you can find evidence that these are not legal names, please post it.
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.
fair point, I don't have evidence that
.or..are illegal names as such. the actual problem is the default local repository layout using artifactId/version verbatim as directory names, which turns these values into literal./..path segments. reworded the javadoc in both validators to say the rejection is due to that mapping, not the names themselves.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.
On Unix and probably other systems . and .. are legal filenames. Dealing with this is a classic Unix sysadmin interview question.
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.
agreed. the reworded javadoc makes no claim the names are illegal, only that the default layout uses them verbatim as directory names so they resolve as the current/parent directory. the rejection is pinned entirely on that mapping.
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.
The names are illegal, see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html, section 4.13:
You can't create a file named
.or...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.
Or did you meant reserved instead of illegal maybe ?
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.
The section you cite refers to pathname resolution, not to pathnames themselves. In practice on most (all?) Unix and Unix like systems it is possible to create a file named "." or ".." as unwise as that might be.
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.
Can you give me a reproducible way to create a file or directory named
.or..?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.
In python,
open()returns21 (EISDIR)on both.and...