Skip to content

Commit b7d8867

Browse files
authored
docs: Document poetry-based analysis behaviour in Python analyzer (#7855)
1 parent 4333171 commit b7d8867

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/site/markdown/analyzers/python.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,32 @@ is grouped into vendor, product, and version buckets. Other analyzers later
1212
use this evidence to identify any Common Platform Enumeration (CPE)
1313
identifiers that apply.
1414

15-
Files Types Scanned: py, whl, egg, zip, PKG-INFO, and METADATA
15+
Files Types Scanned: py, whl, egg, zip, PKG-INFO, and METADATA
16+
17+
Analyzing packages built with `poetry build`
18+
--------------------------------------------
19+
20+
Note that running `dependency-check` on Python packages built with
21+
[Poetry](https://python-poetry.org)'s
22+
[`poetry build`](https://python-poetry.org/docs/cli/#build) command
23+
**may throw an error**:
24+
25+
`[ERROR] Python 'pyproject.toml' found and there is not a 'poetry.lock' or
26+
'requirements.txt' - analysis will be incomplete`
27+
28+
This is **known behaviour** (see
29+
[#6356](https://github.com/dependency-check/DependencyCheck/issues/6356))
30+
and is due to the analyzer analyzing the contents of the tarball
31+
that has been built (in `dist/<package>-<version>.tar.gz` if built using Poetry
32+
defaults). As per [PEP 517](https://peps.python.org/pep-0517/), the tarball
33+
contains the `pyproject.toml` manifest, but not the `poetry.lock` file
34+
that [freezes](https://python-poetry.org/docs/cli/#lock) dependencies at
35+
the versions used to build the project.
36+
37+
To **circumvent this error**, exclude the tarball or the whole build target
38+
directory by running `dependency-check` with `--exclude "dist/**"`.
39+
40+
***WARNING:*** This will not analyze the build artifact itself, but only the lock
41+
file. If dependencies have diverged between the two artifacts - e.g., after
42+
updating a depdendency and locking it without building again - the dependencies
43+
in the build artifact may be affected by vulnerabilities that will go undetected!

0 commit comments

Comments
 (0)