dockerdna 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dockerdna-1.0.2/LICENSE +21 -0
- dockerdna-1.0.2/PKG-INFO +291 -0
- dockerdna-1.0.2/README.md +258 -0
- dockerdna-1.0.2/dockerdna/__init__.py +4 -0
- dockerdna-1.0.2/dockerdna/ai/__init__.py +0 -0
- dockerdna-1.0.2/dockerdna/ai/remediation.py +142 -0
- dockerdna-1.0.2/dockerdna/cli.py +182 -0
- dockerdna-1.0.2/dockerdna/reports/__init__.py +0 -0
- dockerdna-1.0.2/dockerdna/reports/html.py +265 -0
- dockerdna-1.0.2/dockerdna/reports/json_report.py +71 -0
- dockerdna-1.0.2/dockerdna/reports/sarif.py +139 -0
- dockerdna-1.0.2/dockerdna/reports/sbom.py +176 -0
- dockerdna-1.0.2/dockerdna/scanner.py +234 -0
- dockerdna-1.0.2/dockerdna/scanners/__init__.py +0 -0
- dockerdna-1.0.2/dockerdna/scanners/compliance.py +149 -0
- dockerdna-1.0.2/dockerdna/scanners/compose.py +276 -0
- dockerdna-1.0.2/dockerdna/scanners/dockerfile.py +343 -0
- dockerdna-1.0.2/dockerdna/scanners/secrets.py +209 -0
- dockerdna-1.0.2/dockerdna/scanners/supply_chain.py +189 -0
- dockerdna-1.0.2/dockerdna/utils/__init__.py +0 -0
- dockerdna-1.0.2/dockerdna/utils/patterns.py +422 -0
- dockerdna-1.0.2/dockerdna.egg-info/PKG-INFO +291 -0
- dockerdna-1.0.2/dockerdna.egg-info/SOURCES.txt +31 -0
- dockerdna-1.0.2/dockerdna.egg-info/dependency_links.txt +1 -0
- dockerdna-1.0.2/dockerdna.egg-info/entry_points.txt +2 -0
- dockerdna-1.0.2/dockerdna.egg-info/requires.txt +10 -0
- dockerdna-1.0.2/dockerdna.egg-info/top_level.txt +1 -0
- dockerdna-1.0.2/pyproject.toml +69 -0
- dockerdna-1.0.2/setup.cfg +4 -0
- dockerdna-1.0.2/tests/test_compliance.py +70 -0
- dockerdna-1.0.2/tests/test_compose.py +132 -0
- dockerdna-1.0.2/tests/test_dockerfile.py +43 -0
- dockerdna-1.0.2/tests/test_secrets.py +115 -0
dockerdna-1.0.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sunil Gentyala
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dockerdna-1.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dockerdna
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Layer-by-Layer Container Security DNA Analysis — secrets detection, compose scanning, CIS compliance, SBOM, and SARIF output
|
|
5
|
+
Author-email: "Sunil Gentyala, Independent Researcher" <sunil.gentyala@ieee.org>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sunilgentyala/DockerDNA
|
|
8
|
+
Project-URL: Documentation, https://github.com/sunilgentyala/DockerDNA#readme
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/sunilgentyala/DockerDNA/issues
|
|
10
|
+
Keywords: docker,container,security,devops,devsecops,sbom,sarif,cis,compliance,secrets-detection,supply-chain,owasp
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Provides-Extra: ai
|
|
26
|
+
Requires-Dist: anthropic>=0.30; extra == "ai"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
30
|
+
Requires-Dist: black>=24.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# DockerDNA
|
|
35
|
+
|
|
36
|
+
**Layer-by-Layer Container Security DNA Analysis**
|
|
37
|
+
|
|
38
|
+
[](https://github.com/sunilgentyala/DockerDNA/actions)
|
|
39
|
+
[](https://python.org)
|
|
40
|
+
[](LICENSE)
|
|
41
|
+
[](https://www.cisecurity.org/benchmark/docker)
|
|
42
|
+
|
|
43
|
+
DockerDNA is an open-source container security scanner focused on **pre-build analysis**: layer-by-layer Dockerfile attribution, docker-compose.yml auditing, CIS-mapped findings, dual-mode secret detection (regex + Shannon entropy), supply-chain risk scoring, SARIF, and CycloneDX output. It's designed to complement tools like [OWASP DockSec](https://github.com/OWASP/DockSec), Trivy, and Hadolint, not replace them.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## What Makes DockerDNA Unique
|
|
48
|
+
|
|
49
|
+
Verified against each project's public documentation, September 2026. Tools evolve quickly - always
|
|
50
|
+
check upstream docs before relying on this. "not documented" means the capability could not be
|
|
51
|
+
confirmed either way, not that it's absent.
|
|
52
|
+
|
|
53
|
+
| Capability | DockerDNA | DockSec | Trivy | Hadolint |
|
|
54
|
+
|---|:---:|:---:|:---:|:---:|
|
|
55
|
+
| Dockerfile security scan | YES | YES | partial (image/IaC scan) | YES |
|
|
56
|
+
| **docker-compose.yml scanner** | **YES** | YES | not documented | NO |
|
|
57
|
+
| **Secrets detection** | **YES (regex + entropy)** | YES (via Trivy) | YES (regex, built-in rules) | NO |
|
|
58
|
+
| **Entropy detection for unknown secrets** | **YES** | not documented | NO (regex-only) | NO |
|
|
59
|
+
| **CIS Docker Benchmark control-ID mapping** | **YES** | not documented | NO | NO |
|
|
60
|
+
| **SBOM (CycloneDX)** | **YES** | YES | YES | NO |
|
|
61
|
+
| **SARIF output** | **YES** | YES | YES | NO |
|
|
62
|
+
| **Supply chain image risk scoring** | **YES** | not documented | partial (CVE-based) | NO |
|
|
63
|
+
| **Multi-stage build secret leak detection** | **YES** | not documented | NO | NO |
|
|
64
|
+
| **CI/CD threshold gate** | **YES (--threshold)** | YES (--fail-on) | YES | NO |
|
|
65
|
+
| AI-powered remediation | YES (Claude) | YES (multi-LLM) | NO | NO |
|
|
66
|
+
| Layer-by-layer attribution | YES | not documented | NO | NO |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Core Differentiators
|
|
71
|
+
|
|
72
|
+
### 1. Secrets Detection (Regex + Shannon Entropy)
|
|
73
|
+
|
|
74
|
+
DockerDNA scans Dockerfiles, docker-compose.yml, .env files, and any project file for:
|
|
75
|
+
- 20+ known secret formats (AWS keys, GitHub tokens, Google API keys, JWT, database URIs, ...)
|
|
76
|
+
- **High-entropy string analysis** using Shannon entropy - catches *unknown* credential formats that regex misses
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
[CRITICAL] CIS-4.10 Dockerfile line 5: AWS Access Key ID detected (method: pattern)
|
|
80
|
+
[HIGH] CIS-4.10 .env line 12: High-Entropy String detected (entropy: 5.21, method: entropy)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2. docker-compose.yml Security Scanner
|
|
84
|
+
|
|
85
|
+
Audits docker-compose files and maps every finding to a specific CIS Docker Benchmark control ID:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
[CRITICAL] CIS-5.4 webapp: Privileged mode enabled
|
|
89
|
+
[CRITICAL] CIS-5.13 webapp: Docker socket mounted: /var/run/docker.sock
|
|
90
|
+
[HIGH] CIS-5.9 webapp: network_mode: host
|
|
91
|
+
[HIGH] CIS-5.3 webapp: Dangerous capabilities added: ['ALL']
|
|
92
|
+
[MEDIUM] CIS-5.12 webapp: read_only not set to true
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3. CIS Docker Benchmark v1.6 Compliance Report
|
|
96
|
+
|
|
97
|
+
Every finding is tagged with its CIS control ID. A full scorecard is generated:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
CIS Controls: 14 passed / 8 failed / 2 not-checked
|
|
101
|
+
Compliance Score: 63.6%
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Supply Chain Risk Scoring
|
|
105
|
+
|
|
106
|
+
Each FROM instruction receives a 0-100 risk score based on:
|
|
107
|
+
- Registry trust (official vs community vs self-hosted)
|
|
108
|
+
- Tag specificity (digest > version > :latest)
|
|
109
|
+
- Docker Content Trust status
|
|
110
|
+
- Known malicious image name patterns
|
|
111
|
+
|
|
112
|
+
### 5. SARIF Output for GitHub Security Tab
|
|
113
|
+
|
|
114
|
+
Findings appear as inline PR annotations in the GitHub Security tab - no additional integration needed.
|
|
115
|
+
|
|
116
|
+
### 6. CycloneDX SBOM Generation
|
|
117
|
+
|
|
118
|
+
Parses every package install instruction (`apt-get`, `pip`, `npm`, `apk`, `yum`) to produce a CycloneDX 1.5 SBOM with PURL identifiers and layer attribution.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Quick Start
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Not on PyPI yet — install from source for now
|
|
126
|
+
pip install git+https://github.com/sunilgentyala/DockerDNA.git
|
|
127
|
+
|
|
128
|
+
# Scan a Dockerfile
|
|
129
|
+
dockerdna Dockerfile
|
|
130
|
+
|
|
131
|
+
# Scan Dockerfile + docker-compose
|
|
132
|
+
dockerdna Dockerfile --compose docker-compose.yml
|
|
133
|
+
|
|
134
|
+
# Scan entire project directory
|
|
135
|
+
dockerdna --dir ./myapp
|
|
136
|
+
|
|
137
|
+
# All output formats
|
|
138
|
+
dockerdna Dockerfile --compose docker-compose.yml --format json html sarif sbom
|
|
139
|
+
|
|
140
|
+
# CI/CD gate: fail if any HIGH or above
|
|
141
|
+
dockerdna Dockerfile --threshold HIGH
|
|
142
|
+
|
|
143
|
+
# AI-powered remediation (requires ANTHROPIC_API_KEY)
|
|
144
|
+
dockerdna Dockerfile --compose docker-compose.yml --ai
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Output is written to `./dockerdna-results/` by default.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## GitHub Actions Integration
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
# .github/workflows/security.yml
|
|
155
|
+
name: Container Security
|
|
156
|
+
|
|
157
|
+
on: [push, pull_request]
|
|
158
|
+
|
|
159
|
+
jobs:
|
|
160
|
+
dockerdna:
|
|
161
|
+
runs-on: ubuntu-latest
|
|
162
|
+
permissions:
|
|
163
|
+
security-events: write
|
|
164
|
+
|
|
165
|
+
steps:
|
|
166
|
+
- uses: actions/checkout@v4
|
|
167
|
+
- run: pip install git+https://github.com/sunilgentyala/DockerDNA.git
|
|
168
|
+
|
|
169
|
+
- name: Run DockerDNA
|
|
170
|
+
run: |
|
|
171
|
+
dockerdna Dockerfile \
|
|
172
|
+
--compose docker-compose.yml \
|
|
173
|
+
--format sarif json \
|
|
174
|
+
--threshold HIGH \
|
|
175
|
+
--output dockerdna-results
|
|
176
|
+
|
|
177
|
+
- name: Upload to GitHub Security tab
|
|
178
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
179
|
+
if: always()
|
|
180
|
+
with:
|
|
181
|
+
sarif_file: dockerdna-results/report.sarif
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Output Formats
|
|
187
|
+
|
|
188
|
+
| Format | File | Description |
|
|
189
|
+
|--------|------|-------------|
|
|
190
|
+
| `json` | `report.json` | Full structured report with all findings, compliance, and SBOM |
|
|
191
|
+
| `html` | `report.html` | Interactive dashboard with severity badges and CIS scorecard |
|
|
192
|
+
| `sarif` | `report.sarif` | SARIF 2.1.0 for GitHub Advanced Security integration |
|
|
193
|
+
| `sbom` | `sbom.cyclonedx.json` | CycloneDX 1.5 Software Bill of Materials |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## How It Works
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
┌────────────────────────────────────────────────────────┐
|
|
201
|
+
│ DockerDNA Pipeline │
|
|
202
|
+
├──────────────┬──────────────┬─────────────┬────────────┤
|
|
203
|
+
│ Dockerfile │ Compose │ Secrets │ Supply │
|
|
204
|
+
│ Scanner │ Scanner │ Engine │ Chain │
|
|
205
|
+
│ (CIS 4.x) │ (CIS 5.x) │ Regex + │ Scoring │
|
|
206
|
+
│ │ │ Entropy │ │
|
|
207
|
+
└──────┬───────┴──────┬───────┴──────┬──────┴─────┬──────┘
|
|
208
|
+
│ │ │ │
|
|
209
|
+
└──────────────┴──────────────┴────────────┘
|
|
210
|
+
│
|
|
211
|
+
┌─────────▼─────────┐
|
|
212
|
+
│ CIS Compliance │
|
|
213
|
+
│ Mapper │
|
|
214
|
+
└─────────┬─────────┘
|
|
215
|
+
│
|
|
216
|
+
┌───────────────┼───────────────┐
|
|
217
|
+
▼ ▼ ▼
|
|
218
|
+
JSON/HTML SARIF SBOM
|
|
219
|
+
Reports (GitHub Security) (CycloneDX)
|
|
220
|
+
│
|
|
221
|
+
▼ (optional)
|
|
222
|
+
AI Remediation
|
|
223
|
+
(Anthropic Claude)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Comparison with OWASP DockSec
|
|
229
|
+
|
|
230
|
+
DockSec wraps Trivy, Hadolint, and Docker Scout with multi-LLM AI explanations and automated
|
|
231
|
+
patching, and (per its current docs, checked September 2026) also covers docker-compose scanning,
|
|
232
|
+
SARIF, SBOM, and a `--fail-on` CI gate. DockerDNA focuses specifically on pre-build analysis with a
|
|
233
|
+
few things not documented elsewhere:
|
|
234
|
+
|
|
235
|
+
- **Entropy-based secret detection.** DockSec's secret handling isn't publicly documented beyond
|
|
236
|
+
redaction; Trivy (which DockSec wraps) is regex-only. DockerDNA's dual-mode scanner (pattern +
|
|
237
|
+
Shannon entropy) also catches custom or rotated credentials that match no known pattern.
|
|
238
|
+
- **CIS Docker Benchmark control-ID mapping.** Every finding is tagged with its specific CIS v1.6
|
|
239
|
+
control ID and rolled into a pass/fail/not-checked compliance scorecard, not just a severity bucket.
|
|
240
|
+
- **Layer-by-layer attribution.** Every finding traces back to the exact instruction and build stage
|
|
241
|
+
that introduced it, including secrets that leak across multi-stage builds.
|
|
242
|
+
|
|
243
|
+
If you already use DockSec for its AI-powered explanations and automated Dockerfile patching,
|
|
244
|
+
DockerDNA is a good complement for pre-build compose/secrets/compliance analysis, not a replacement.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Installation
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Core (no AI) — not on PyPI yet, install from source
|
|
252
|
+
pip install git+https://github.com/sunilgentyala/DockerDNA.git
|
|
253
|
+
|
|
254
|
+
# With AI remediation
|
|
255
|
+
pip install "dockerdna[ai] @ git+https://github.com/sunilgentyala/DockerDNA.git"
|
|
256
|
+
|
|
257
|
+
# Development
|
|
258
|
+
git clone https://github.com/sunilgentyala/DockerDNA.git
|
|
259
|
+
cd DockerDNA
|
|
260
|
+
pip install -e ".[dev]"
|
|
261
|
+
pytest
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Environment Variables
|
|
267
|
+
|
|
268
|
+
| Variable | Description |
|
|
269
|
+
|----------|-------------|
|
|
270
|
+
| `ANTHROPIC_API_KEY` | Required for `--ai` flag (AI remediation) |
|
|
271
|
+
| `DOCKER_CONTENT_TRUST` | Set to `1` to enable image signing verification |
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Contributing
|
|
276
|
+
|
|
277
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) to get set up, [CHANGELOG.md](CHANGELOG.md) for what's
|
|
278
|
+
changed and what's on the roadmap, and [SECURITY.md](SECURITY.md) to report a vulnerability
|
|
279
|
+
(please don't file those as a public issue). This project follows the
|
|
280
|
+
[Contributor Covenant](CODE_OF_CONDUCT.md).
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
MIT License. See [LICENSE](LICENSE).
|
|
285
|
+
|
|
286
|
+
## Author
|
|
287
|
+
|
|
288
|
+
**Sunil Gentyala, Independent Researcher**
|
|
289
|
+
IEEE senior Member | Security Researcher
|
|
290
|
+
- IEEE: sunil.gentyala@ieee.org
|
|
291
|
+
- GitHub: [@sunilgentyala](https://github.com/sunilgentyala)
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# DockerDNA
|
|
2
|
+
|
|
3
|
+
**Layer-by-Layer Container Security DNA Analysis**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/sunilgentyala/DockerDNA/actions)
|
|
6
|
+
[](https://python.org)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://www.cisecurity.org/benchmark/docker)
|
|
9
|
+
|
|
10
|
+
DockerDNA is an open-source container security scanner focused on **pre-build analysis**: layer-by-layer Dockerfile attribution, docker-compose.yml auditing, CIS-mapped findings, dual-mode secret detection (regex + Shannon entropy), supply-chain risk scoring, SARIF, and CycloneDX output. It's designed to complement tools like [OWASP DockSec](https://github.com/OWASP/DockSec), Trivy, and Hadolint, not replace them.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## What Makes DockerDNA Unique
|
|
15
|
+
|
|
16
|
+
Verified against each project's public documentation, September 2026. Tools evolve quickly - always
|
|
17
|
+
check upstream docs before relying on this. "not documented" means the capability could not be
|
|
18
|
+
confirmed either way, not that it's absent.
|
|
19
|
+
|
|
20
|
+
| Capability | DockerDNA | DockSec | Trivy | Hadolint |
|
|
21
|
+
|---|:---:|:---:|:---:|:---:|
|
|
22
|
+
| Dockerfile security scan | YES | YES | partial (image/IaC scan) | YES |
|
|
23
|
+
| **docker-compose.yml scanner** | **YES** | YES | not documented | NO |
|
|
24
|
+
| **Secrets detection** | **YES (regex + entropy)** | YES (via Trivy) | YES (regex, built-in rules) | NO |
|
|
25
|
+
| **Entropy detection for unknown secrets** | **YES** | not documented | NO (regex-only) | NO |
|
|
26
|
+
| **CIS Docker Benchmark control-ID mapping** | **YES** | not documented | NO | NO |
|
|
27
|
+
| **SBOM (CycloneDX)** | **YES** | YES | YES | NO |
|
|
28
|
+
| **SARIF output** | **YES** | YES | YES | NO |
|
|
29
|
+
| **Supply chain image risk scoring** | **YES** | not documented | partial (CVE-based) | NO |
|
|
30
|
+
| **Multi-stage build secret leak detection** | **YES** | not documented | NO | NO |
|
|
31
|
+
| **CI/CD threshold gate** | **YES (--threshold)** | YES (--fail-on) | YES | NO |
|
|
32
|
+
| AI-powered remediation | YES (Claude) | YES (multi-LLM) | NO | NO |
|
|
33
|
+
| Layer-by-layer attribution | YES | not documented | NO | NO |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Core Differentiators
|
|
38
|
+
|
|
39
|
+
### 1. Secrets Detection (Regex + Shannon Entropy)
|
|
40
|
+
|
|
41
|
+
DockerDNA scans Dockerfiles, docker-compose.yml, .env files, and any project file for:
|
|
42
|
+
- 20+ known secret formats (AWS keys, GitHub tokens, Google API keys, JWT, database URIs, ...)
|
|
43
|
+
- **High-entropy string analysis** using Shannon entropy - catches *unknown* credential formats that regex misses
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
[CRITICAL] CIS-4.10 Dockerfile line 5: AWS Access Key ID detected (method: pattern)
|
|
47
|
+
[HIGH] CIS-4.10 .env line 12: High-Entropy String detected (entropy: 5.21, method: entropy)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. docker-compose.yml Security Scanner
|
|
51
|
+
|
|
52
|
+
Audits docker-compose files and maps every finding to a specific CIS Docker Benchmark control ID:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
[CRITICAL] CIS-5.4 webapp: Privileged mode enabled
|
|
56
|
+
[CRITICAL] CIS-5.13 webapp: Docker socket mounted: /var/run/docker.sock
|
|
57
|
+
[HIGH] CIS-5.9 webapp: network_mode: host
|
|
58
|
+
[HIGH] CIS-5.3 webapp: Dangerous capabilities added: ['ALL']
|
|
59
|
+
[MEDIUM] CIS-5.12 webapp: read_only not set to true
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. CIS Docker Benchmark v1.6 Compliance Report
|
|
63
|
+
|
|
64
|
+
Every finding is tagged with its CIS control ID. A full scorecard is generated:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
CIS Controls: 14 passed / 8 failed / 2 not-checked
|
|
68
|
+
Compliance Score: 63.6%
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 4. Supply Chain Risk Scoring
|
|
72
|
+
|
|
73
|
+
Each FROM instruction receives a 0-100 risk score based on:
|
|
74
|
+
- Registry trust (official vs community vs self-hosted)
|
|
75
|
+
- Tag specificity (digest > version > :latest)
|
|
76
|
+
- Docker Content Trust status
|
|
77
|
+
- Known malicious image name patterns
|
|
78
|
+
|
|
79
|
+
### 5. SARIF Output for GitHub Security Tab
|
|
80
|
+
|
|
81
|
+
Findings appear as inline PR annotations in the GitHub Security tab - no additional integration needed.
|
|
82
|
+
|
|
83
|
+
### 6. CycloneDX SBOM Generation
|
|
84
|
+
|
|
85
|
+
Parses every package install instruction (`apt-get`, `pip`, `npm`, `apk`, `yum`) to produce a CycloneDX 1.5 SBOM with PURL identifiers and layer attribution.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Quick Start
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Not on PyPI yet — install from source for now
|
|
93
|
+
pip install git+https://github.com/sunilgentyala/DockerDNA.git
|
|
94
|
+
|
|
95
|
+
# Scan a Dockerfile
|
|
96
|
+
dockerdna Dockerfile
|
|
97
|
+
|
|
98
|
+
# Scan Dockerfile + docker-compose
|
|
99
|
+
dockerdna Dockerfile --compose docker-compose.yml
|
|
100
|
+
|
|
101
|
+
# Scan entire project directory
|
|
102
|
+
dockerdna --dir ./myapp
|
|
103
|
+
|
|
104
|
+
# All output formats
|
|
105
|
+
dockerdna Dockerfile --compose docker-compose.yml --format json html sarif sbom
|
|
106
|
+
|
|
107
|
+
# CI/CD gate: fail if any HIGH or above
|
|
108
|
+
dockerdna Dockerfile --threshold HIGH
|
|
109
|
+
|
|
110
|
+
# AI-powered remediation (requires ANTHROPIC_API_KEY)
|
|
111
|
+
dockerdna Dockerfile --compose docker-compose.yml --ai
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Output is written to `./dockerdna-results/` by default.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## GitHub Actions Integration
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
# .github/workflows/security.yml
|
|
122
|
+
name: Container Security
|
|
123
|
+
|
|
124
|
+
on: [push, pull_request]
|
|
125
|
+
|
|
126
|
+
jobs:
|
|
127
|
+
dockerdna:
|
|
128
|
+
runs-on: ubuntu-latest
|
|
129
|
+
permissions:
|
|
130
|
+
security-events: write
|
|
131
|
+
|
|
132
|
+
steps:
|
|
133
|
+
- uses: actions/checkout@v4
|
|
134
|
+
- run: pip install git+https://github.com/sunilgentyala/DockerDNA.git
|
|
135
|
+
|
|
136
|
+
- name: Run DockerDNA
|
|
137
|
+
run: |
|
|
138
|
+
dockerdna Dockerfile \
|
|
139
|
+
--compose docker-compose.yml \
|
|
140
|
+
--format sarif json \
|
|
141
|
+
--threshold HIGH \
|
|
142
|
+
--output dockerdna-results
|
|
143
|
+
|
|
144
|
+
- name: Upload to GitHub Security tab
|
|
145
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
146
|
+
if: always()
|
|
147
|
+
with:
|
|
148
|
+
sarif_file: dockerdna-results/report.sarif
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Output Formats
|
|
154
|
+
|
|
155
|
+
| Format | File | Description |
|
|
156
|
+
|--------|------|-------------|
|
|
157
|
+
| `json` | `report.json` | Full structured report with all findings, compliance, and SBOM |
|
|
158
|
+
| `html` | `report.html` | Interactive dashboard with severity badges and CIS scorecard |
|
|
159
|
+
| `sarif` | `report.sarif` | SARIF 2.1.0 for GitHub Advanced Security integration |
|
|
160
|
+
| `sbom` | `sbom.cyclonedx.json` | CycloneDX 1.5 Software Bill of Materials |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## How It Works
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
┌────────────────────────────────────────────────────────┐
|
|
168
|
+
│ DockerDNA Pipeline │
|
|
169
|
+
├──────────────┬──────────────┬─────────────┬────────────┤
|
|
170
|
+
│ Dockerfile │ Compose │ Secrets │ Supply │
|
|
171
|
+
│ Scanner │ Scanner │ Engine │ Chain │
|
|
172
|
+
│ (CIS 4.x) │ (CIS 5.x) │ Regex + │ Scoring │
|
|
173
|
+
│ │ │ Entropy │ │
|
|
174
|
+
└──────┬───────┴──────┬───────┴──────┬──────┴─────┬──────┘
|
|
175
|
+
│ │ │ │
|
|
176
|
+
└──────────────┴──────────────┴────────────┘
|
|
177
|
+
│
|
|
178
|
+
┌─────────▼─────────┐
|
|
179
|
+
│ CIS Compliance │
|
|
180
|
+
│ Mapper │
|
|
181
|
+
└─────────┬─────────┘
|
|
182
|
+
│
|
|
183
|
+
┌───────────────┼───────────────┐
|
|
184
|
+
▼ ▼ ▼
|
|
185
|
+
JSON/HTML SARIF SBOM
|
|
186
|
+
Reports (GitHub Security) (CycloneDX)
|
|
187
|
+
│
|
|
188
|
+
▼ (optional)
|
|
189
|
+
AI Remediation
|
|
190
|
+
(Anthropic Claude)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Comparison with OWASP DockSec
|
|
196
|
+
|
|
197
|
+
DockSec wraps Trivy, Hadolint, and Docker Scout with multi-LLM AI explanations and automated
|
|
198
|
+
patching, and (per its current docs, checked September 2026) also covers docker-compose scanning,
|
|
199
|
+
SARIF, SBOM, and a `--fail-on` CI gate. DockerDNA focuses specifically on pre-build analysis with a
|
|
200
|
+
few things not documented elsewhere:
|
|
201
|
+
|
|
202
|
+
- **Entropy-based secret detection.** DockSec's secret handling isn't publicly documented beyond
|
|
203
|
+
redaction; Trivy (which DockSec wraps) is regex-only. DockerDNA's dual-mode scanner (pattern +
|
|
204
|
+
Shannon entropy) also catches custom or rotated credentials that match no known pattern.
|
|
205
|
+
- **CIS Docker Benchmark control-ID mapping.** Every finding is tagged with its specific CIS v1.6
|
|
206
|
+
control ID and rolled into a pass/fail/not-checked compliance scorecard, not just a severity bucket.
|
|
207
|
+
- **Layer-by-layer attribution.** Every finding traces back to the exact instruction and build stage
|
|
208
|
+
that introduced it, including secrets that leak across multi-stage builds.
|
|
209
|
+
|
|
210
|
+
If you already use DockSec for its AI-powered explanations and automated Dockerfile patching,
|
|
211
|
+
DockerDNA is a good complement for pre-build compose/secrets/compliance analysis, not a replacement.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Installation
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Core (no AI) — not on PyPI yet, install from source
|
|
219
|
+
pip install git+https://github.com/sunilgentyala/DockerDNA.git
|
|
220
|
+
|
|
221
|
+
# With AI remediation
|
|
222
|
+
pip install "dockerdna[ai] @ git+https://github.com/sunilgentyala/DockerDNA.git"
|
|
223
|
+
|
|
224
|
+
# Development
|
|
225
|
+
git clone https://github.com/sunilgentyala/DockerDNA.git
|
|
226
|
+
cd DockerDNA
|
|
227
|
+
pip install -e ".[dev]"
|
|
228
|
+
pytest
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Environment Variables
|
|
234
|
+
|
|
235
|
+
| Variable | Description |
|
|
236
|
+
|----------|-------------|
|
|
237
|
+
| `ANTHROPIC_API_KEY` | Required for `--ai` flag (AI remediation) |
|
|
238
|
+
| `DOCKER_CONTENT_TRUST` | Set to `1` to enable image signing verification |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Contributing
|
|
243
|
+
|
|
244
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) to get set up, [CHANGELOG.md](CHANGELOG.md) for what's
|
|
245
|
+
changed and what's on the roadmap, and [SECURITY.md](SECURITY.md) to report a vulnerability
|
|
246
|
+
(please don't file those as a public issue). This project follows the
|
|
247
|
+
[Contributor Covenant](CODE_OF_CONDUCT.md).
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
MIT License. See [LICENSE](LICENSE).
|
|
252
|
+
|
|
253
|
+
## Author
|
|
254
|
+
|
|
255
|
+
**Sunil Gentyala, Independent Researcher**
|
|
256
|
+
IEEE senior Member | Security Researcher
|
|
257
|
+
- IEEE: sunil.gentyala@ieee.org
|
|
258
|
+
- GitHub: [@sunilgentyala](https://github.com/sunilgentyala)
|
|
File without changes
|