gh-146121: pkgutil.get_data() reject invalid resource arguments#146122
gh-146121: pkgutil.get_data() reject invalid resource arguments#146122FFY00 merged 4 commits intopython:mainfrom
pkgutil.get_data() reject invalid resource arguments#146122Conversation
Lib/test/test_pkgutil.py
Outdated
| with self.assertRaises(ValueError): | ||
| pkgutil.get_data(pkg, '/etc/passwd') |
There was a problem hiding this comment.
Right, this should be POSIX-only. We should also add a test for absolute Windows paths.
There was a problem hiding this comment.
Oh, that doesn’t work either (I'm unfamiliar with Windows... :-( )
There was a problem hiding this comment.
| with self.assertRaises(ValueError): | |
| pkgutil.get_data(pkg, '/etc/passwd') | |
| with self.assertRaises(ValueError): | |
| pkgutil.get_data(pkg, os.path.abspath('/etc/passwd')) |
Maybe this will work
|
Thanks @StanFromIreland for the PR, and @FFY00 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11, 3.12, 3.13, 3.14. |
…ts (pythonGH-146122) (cherry picked from commit bcdf231946b1da8bdfbab4c05539bb0cc964a1c7) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
…ts (pythonGH-146122) (cherry picked from commit bcdf231) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
|
GH-146133 is a backport of this pull request to the 3.14 branch. |
…ts (pythonGH-146122) (cherry picked from commit bcdf231) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
|
GH-146134 is a backport of this pull request to the 3.13 branch. |
…ts (pythonGH-146122) (cherry picked from commit bcdf231) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
…ts (pythonGH-146122) (cherry picked from commit bcdf231) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
|
GH-146135 is a backport of this pull request to the 3.12 branch. |
|
GH-146136 is a backport of this pull request to the 3.11 branch. |
|
GH-146137 is a backport of this pull request to the 3.10 branch. |
|
Thanks for the review Filipe! 73 :-) |
pkgutil.get_data()restrictions are not enforced #146121