How to fix: Python setup.py source exposed
The response is a Python setup.py: a setup() call with an install_requires list.
Why it matters
Beyond the declared dependency list, setup.py is executable Python that runs at install time. A served copy shows any custom cmdclass, build step or post-install hook the package runs, and those are exactly the places where a package fetches something at install time or writes outside its own tree.
Unlike a lockfile, this one is code, so it is worth reading rather than just inventorying. The dependency_links and extras_require entries are also informative: dependency_links can point at a private index or a direct URL, and extras name optional integrations the application supports even when they are not installed here.
How to fix it
- 1Remove packaging files from the served directory; deploy the installed package, not the source distribution.
- 2Review the file's own install-time hooks: a setup.py that downloads or executes anything at install time is a supply-chain risk in its own right.
- 3Audit the versions in install_requires.
Code examples
Nginx: deny Python packaging files
location ~* /(setup\.py|setup\.cfg|pyproject\.toml|MANIFEST\.in)$ {
return 404;
}References
Detected automatically by VulnRadar. The check id is supply-chain-setup-py-exposed, stable across every scan so you can filter or diff on it.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumRuby Gemfile or Gemfile.lock Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
Questions
- How severe is Python setup.py source exposed?
- VulnRadar rates this low severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id supply-chain-setup-py-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Python setup.py source exposed map to?
- It maps to CWE-540. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.