pkg_resources.resource_string allows absolute paths and paths with .. - contrary to docs
Open
@jaraco is already working on this.
Since Jan 17, 2019.
bug
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
The https://setuptools.readthedocs.io/en/latest/pkg_resources.html ("Basic Resource Access") page claims:
Note that resource names must be /-separated paths and cannot be absolute (i.e. no leading /)
or contain relative names like "..".
Let's see:
>>> pkg_resources.resource_string('multiprocessing', '/__init__.py')
'#\n# Package analogous …
>>> pkg_resources.resource_string('multiprocessing', '../../../../etc/passwd')
'root:x:0:0:root…
I'd say some validation is missing.
Tested on both python2.7 and python3.6, with pkg_resources as in Ubuntu 18.04
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.