-
Notifications
You must be signed in to change notification settings - Fork 1k
Feature request: "view source" tool for inspecting package contents #5118
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
Comments
There are quite a few challenges in building such a feature. For smaller packages, writing code which pulls a .tar.gz and turns it into a file listing / visible source code in response to an incoming HTTP request would be feasible (and highly catchable via varnish), but this probably won't work for larger files - pulling a 100MB .tar.gz and decompressing it on demand may not be feasible. Can we get numbers on the average size of packages and we how many outliers there are? For those larger packages, maybe this will require extra processing on upload. This could be expensive in terms of both CPU and storage, and could open up zip bomb exploits if not implemented carefully. |
One problem that is more specific to PyPI is that some packages can be uploaded in multiple formats - different wheels for example. Malicious code could potentially be hidden in just one of the wheel variants. A really great implementation of this feature would also highlight differences between the contents of those different packages. This becomes not just a more complex implementation challenge but a UI design challenge as well. |
... and while I'm throwing around crazy ideas: a really neat implementation of this would include a way to render diffsbetween different versions. Now we are re-implementing a non-trivial portion of GitHub! |
npm COO Laurie Voss says about this suggestion:
|
Merging duplicate issue #7877 originally posted by @uranusjr @uranusjr wrote:
@di wrote:
@uranusjr wrote:
|
We've got something like this now: https://inspector.pypi.io/ This isn't anything close to production-grade so I wouldn't recommend pointing a lot of traffic at it, but it provides a way to introspect packages on PyPI, without exposing PyPI to the need to introspect packages. This isn't integrated into PyPI in any way except for the admin interface, but once it is a little more developed that could be possible. |
This is really neat, I love it! Exactly the kind of thing I was hoping for here. If you're worried about traffic load on it, one alternative could be to implement the same thing entirely client-side. PyPI serves wheels etc with open CORS headers, so it's possible for JavaScript in a browser to fetch those packages, decode them and display them. I built a very basic demo of that here: https://tools.simonwillison.net/zip-wheel-explorer |
I think we're less worried about the traffic and more worried about the risk of extracting or displaying user-submitted content on the pypi.org domain. For example, your demo has an XSS vulnerability: try exploring this wheel and click on the |
With trusted publishing, would it be easy to have a link from pypi release to github commit tree? |
Yep, see #17122 (comment) |
Triaging: I think this is complete per both #5118 (comment) and also the new UI view we have for attestation contents! |
The recent event-stream problem
on npm highlighted an issue that is also relevant to PyPI: even if a package links to a GitHub repository there is no guarantee that the code in the uploaded package matches the code in the repo.
One way this could be helped is for PyPI to provide a "view package contents" link next to each downloadable archive that opens a web interface for browsing the files in that package.
This could make it easier to spot deliberate exploits, but would also be a useful general feature for people who want to quickly understand more about the details of a package before they install it.
The text was updated successfully, but these errors were encountered: