Commit be56bee
feat(providers): add Dockerfile/Containerfile provider for image analysis (#569)
* feat(providers): add Dockerfile/Containerfile provider for image analysis
Add a new provider that recognizes Dockerfile and Containerfile manifests
for component and stack analysis. The provider parses FROM lines to extract
the base image reference, then reuses generateImageSBOM to produce a
CycloneDX SBOM. Multi-stage Dockerfiles use the final stage's FROM image.
Implements TC-4937
Assisted-by: Claude Code
* fix(providers): strip all leading flags from Dockerfile FROM lines
The parseFromImage function previously only stripped a single --flag
token using a regex. Dockerfile syntax allows multiple flags before
the image reference. Replace the single regex with a loop that skips
all leading --flag tokens.
TC-4977
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code
* fix(providers): detect and reject ARG-substituted FROM targets
When a Dockerfile uses ARG substitution in FROM lines (e.g.
FROM ${BASE_IMAGE}), parseFromImage now throws a clear error
instead of passing the unresolved variable to downstream functions.
TC-4978
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code
* feat(oci): normalize Docker Hub refs and use tree-sitter for Dockerfile parsing
Normalize Docker Hub image references in PURL generation so all FROM
formats (node:22, docker.io/node:22, docker.io/library/node:22) produce
the same repository_url=docker.io/node qualifier, matching the Hummingbird
hardened image index. Migrate Dockerfile FROM parsing from regex to
tree-sitter-containerfile for robust AST-based extraction. Rename
TRUSTIFY_DA_RECOMMENDATIONS_ENABLED to TRUSTIFY_DA_RECOMMEND and use
getCustom() for consistent env/option lookup. Support suffixed Dockerfile
variants (e.g. Dockerfile.dev).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent ab5949f commit be56bee
11 files changed
Lines changed: 489 additions & 168 deletions
File tree
- src
- oci_image
- providers
- test/providers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
698 | | - | |
| 698 | + | |
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| |||
0 commit comments