feat(python): add packaging detector and respective hook (#1223)

Co-authored-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Ankush K
2021-09-13 23:29:11 +05:30
committed by GitHub
parent 19c0b70d26
commit dbc7a83e8c
25 changed files with 191 additions and 99 deletions

View File

@@ -2,23 +2,32 @@
`Trivy` automatically detects the following files in the container and scans vulnerabilities in the application dependencies.
| Language | File | Dev dependencies |
| ---------| ------------------------------------------------| -----------------|
| Ruby | Gemfile.lock | included |
| Python | Pipfile.lock | excluded |
| | poetry.lock | included |
| PHP | composer.lock | excluded |
| Node.js | package-lock.json | excluded |
| | yarn.lock | included |
| .NET | packages.lock.json | included |
| Java | JAR/WAR/EAR (`*.jar`, `*.war`, and `*.ear`)[^1] | included |
| Go | Binaries built by Go[^2] | excluded |
| | go.sum | included |
| Language | File | Image[^6] | Filesystem[^7] | Repository[^8] |Dev dependencies |
|---------|-------------------------|:---------:|:--------------:|:---------------:|-----------------|
| Ruby | Gemfile.lock | ✅ | ✅ | ✅ | included |
| Python | Pipfile.lock | - | ✅ | ✅ |excluded |
| | poetry.lock | - | ✅ | ✅ | included |
| | requirements.txt | - | ✅ | ✅ | included |
| | egg package[^1] | ✅ | ✅ | - | excluded |
| | wheel package[^2] | ✅ | ✅ | - | excluded |
| PHP | composer.lock | ✅ | ✅ | ✅ | excluded |
| Node.js | package-lock.json | ✅ | ✅ | ✅ | excluded |
| | yarn.lock | ✅ | ✅ | ✅ | ncluded |
| .NET | packages.lock.json | ✅ | ✅ | ✅ | included |
| Java | JAR/WAR/EAR[^3][^4] | ✅ | ✅ | ✅ | included |
| Go | Binaries built by Go[^5] | ✅ | ✅ | - | excluded |
| | go.sum | - | ✅ | ✅ | included |
The path of these files does not matter.
Example: [Dockerfile](https://github.com/aquasecurity/trivy-ci-test/blob/main/Dockerfile)
[^1]: It requires the Internet access
[^2]: UPX-compressed binaries don't work
[^1]: `*.egg-info`, `*.egg-info/PKG-INFO`, `*.egg` and `EGG-INFO/PKG-INFO`
[^2]: `.dist-info/META-DATA`
[^3]: `*.jar`, `*.war`, and `*.ear`
[^4]: It requires the Internet access
[^5]: UPX-compressed binaries don't work
[^6]: ✅ means "enabled" and `-` means "disabled" in the image scanning
[^7]: ✅ means "enabled" and `-` means "disabled" in the filesystem scanning
[^8]: ✅ means "enabled" and `-` means "disabled" in the git repository scanning