How to fix: Python poetry.lock exposed
The response is a Poetry lockfile: a [[package]] table set with Poetry's own markers. Either its generation banner, or the [metadata] lock-version key that Cargo's identically shaped file does not have.
Why it matters
The lockfile pins every transitive package to an exact version, so an attacker gets a precise inventory to cross-reference against advisory databases without probing anything. Poetry also records dev-group packages, which name the test and tooling stack, and any private source it resolves against, which names an internal package index.
Distinguished from Cargo.lock, which uses the same [[package]] table format, by requiring a marker only Poetry writes. Publishing this is not itself an exploit; it removes the reconnaissance step from one. The practical question after finding it is whether any pinned version is currently vulnerable and whether the file names a private index URL.
How to fix it
- 1Stop serving poetry.lock from the web root: it belongs in the repository and the build image, not the deployed static output.
- 2Add a deny rule at the web server or CDN for lock and manifest filenames so a future copy does not become reachable.
- 3Run a vulnerability scan against the pinned versions, since the exact set is now public.
Code examples
Nginx: refuse dependency manifests
location ~* /(poetry\.lock|pyproject\.toml|Pipfile(\.lock)?|requirements[\w.-]*\.txt)$ {
return 404;
}Audit the pinned set
poetry export -f requirements.txt --without-hashes | pip-audit -r /dev/stdinReferences
Detected automatically by VulnRadar. The check id is supply-chain-poetry-lock-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 poetry.lock 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-poetry-lock-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Python poetry.lock 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.