alirezaaminzadeh commited on
Commit
62e0847
·
verified ·
1 Parent(s): 8b7a0cc

Publish AriaImageGuard Dockerfile/Compose lab fixtures and pinned Hadolint/CIS catalog

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +46 -0
  2. data/controls.json +7 -0
  3. data/evaluation.json +170 -0
  4. data/expected.json +52 -0
  5. data/sample_preview.json +30 -0
  6. data/scenarios.jsonl +5 -0
  7. data/schema.json +24 -0
  8. data/splits.json +13 -0
  9. data/stacks/s01/Dockerfile +5 -0
  10. data/stacks/s01/compose.yaml +10 -0
  11. data/stacks/s01/inspect.json +16 -0
  12. data/stacks/s02/Dockerfile +5 -0
  13. data/stacks/s02/compose.yaml +11 -0
  14. data/stacks/s02/inspect.json +13 -0
  15. data/stacks/s03/Dockerfile +4 -0
  16. data/stacks/s03/compose.yaml +12 -0
  17. data/stacks/s04/Dockerfile +4 -0
  18. data/stacks/s04/compose.yaml +8 -0
  19. data/stacks/s04/inspect.json +10 -0
  20. data/stacks/s05/Dockerfile +9 -0
  21. data/stacks/s05/compose.yaml +9 -0
  22. demo/.gitattributes +11 -0
  23. demo/.gitignore +8 -0
  24. demo/LICENSE +17 -0
  25. demo/README.md +57 -0
  26. demo/app.py +8 -0
  27. demo/evaluations/evaluation.json +170 -0
  28. demo/examples/controls.json +7 -0
  29. demo/examples/evaluation.json +170 -0
  30. demo/examples/expected.json +52 -0
  31. demo/examples/sample_preview.json +30 -0
  32. demo/examples/scenarios.jsonl +5 -0
  33. demo/examples/schema.json +24 -0
  34. demo/examples/splits.json +13 -0
  35. demo/examples/stacks/s01/Dockerfile +5 -0
  36. demo/examples/stacks/s01/compose.yaml +10 -0
  37. demo/examples/stacks/s01/inspect.json +16 -0
  38. demo/examples/stacks/s02/Dockerfile +5 -0
  39. demo/examples/stacks/s02/compose.yaml +11 -0
  40. demo/examples/stacks/s02/inspect.json +13 -0
  41. demo/examples/stacks/s03/Dockerfile +4 -0
  42. demo/examples/stacks/s03/compose.yaml +12 -0
  43. demo/examples/stacks/s04/Dockerfile +4 -0
  44. demo/examples/stacks/s04/compose.yaml +8 -0
  45. demo/examples/stacks/s04/inspect.json +10 -0
  46. demo/examples/stacks/s05/Dockerfile +9 -0
  47. demo/examples/stacks/s05/compose.yaml +9 -0
  48. demo/requirements.txt +5 -0
  49. demo/src/__init__.py +1 -0
  50. demo/src/baseline.py +56 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ pretty_name: AriaImageGuard Container Hardening Lab
4
+ task_categories:
5
+ - other
6
+ tags:
7
+ - cybersecurity
8
+ - container-security
9
+ - dockerfile
10
+ - compose
11
+ - synthetic
12
+ language:
13
+ - en
14
+ - fa
15
+ size_categories:
16
+ - n<1K
17
+ ---
18
+
19
+ # AriaImageGuard container hardening lab
20
+
21
+ Synthetic Dockerfile, Compose, and pre-generated inspect JSON for the AriaImageGuard configuration-review demo: a privileged shop web, a hardened lookalike, socket/capability escape, a missing-USER case that stays unknown, and a secret/ADD/curl|sh build.
22
+
23
+ Organization dataset and collection are public. Live Gradio is [alirezaaminzadeh/aria-image-guard](https://huggingface.co/spaces/alirezaaminzadeh/aria-image-guard) and the organization card is [AriaAICompany/aria-image-guard](https://huggingface.co/spaces/AriaAICompany/aria-image-guard). Runnable Space source is stored in `demo/`. Collection: [Aria AI — Cybersecurity](https://huggingface.co/collections/AriaAICompany/aria-ai-cybersecurity-6ab01faa3995a3bb737b58a7).
24
+
25
+ Generated data, seed 18. Image names, tokens, and hosts are laboratory placeholders. The control catalog is `hadolint-cis-docker-mapped-v1` (2026-09-20). Hadolint and Docker are not executed on this dataset. A missing USER is not a complete runtime verdict. Package CVEs belong to AriaSBOM.
26
+
27
+ ## Files
28
+
29
+ - data/scenarios.jsonl
30
+ - data/expected.json
31
+ - data/schema.json
32
+ - data/splits.json
33
+ - data/controls.json
34
+ - data/evaluation.json
35
+ - data/sample_preview.json
36
+ - data/stacks/ — five scenario folders
37
+ - demo/ — runnable Gradio Space source
38
+ - showcase/ — organization static card
39
+
40
+ ## Split
41
+
42
+ Development vs test is by scenario family: privileged runtime and socket/caps vs lookalike, missing USER, and build hygiene. Renaming one service of the same finding is not placed across the split.
43
+
44
+ ## License
45
+
46
+ CC-BY-4.0. Keep the synthetic-data and laboratory-config labels.
data/controls.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "ruleset_id": "hadolint-cis-docker-mapped-v1",
3
+ "date": "2026-09-20",
4
+ "n_controls": 24,
5
+ "engine_profile": "dockerfile-compose-inspect",
6
+ "note": "Hadolint and Docker are not executed. CVE/SBOM is project 07."
7
+ }
data/evaluation.json ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 18,
3
+ "n_scenarios": 5,
4
+ "n_controls": 24,
5
+ "engine_profile": "dockerfile-compose-inspect",
6
+ "rows": [
7
+ {
8
+ "scenario_id": "S01",
9
+ "family": "privileged_runtime",
10
+ "split": "development",
11
+ "method": "contextual_rules",
12
+ "match_precision": 1.0,
13
+ "match_recall": 1.0,
14
+ "locator_accuracy": 1.0,
15
+ "patch_fix_rate": 1.0,
16
+ "unknown_rate": 0.125,
17
+ "baseline_extra": 1,
18
+ "verdict": "needs_review",
19
+ "n_resources": 3
20
+ },
21
+ {
22
+ "scenario_id": "S01",
23
+ "family": "privileged_runtime",
24
+ "split": "development",
25
+ "method": "kind_only",
26
+ "match_precision": null,
27
+ "match_recall": null,
28
+ "locator_accuracy": null,
29
+ "patch_fix_rate": null,
30
+ "unknown_rate": 0.0,
31
+ "baseline_extra": 1,
32
+ "verdict": "needs_review",
33
+ "n_resources": 3
34
+ },
35
+ {
36
+ "scenario_id": "S02",
37
+ "family": "benign_lookalike",
38
+ "split": "test",
39
+ "method": "contextual_rules",
40
+ "match_precision": 1.0,
41
+ "match_recall": 1.0,
42
+ "locator_accuracy": 1.0,
43
+ "patch_fix_rate": null,
44
+ "unknown_rate": 0.0,
45
+ "baseline_extra": 1,
46
+ "verdict": "needs_review",
47
+ "n_resources": 3
48
+ },
49
+ {
50
+ "scenario_id": "S02",
51
+ "family": "benign_lookalike",
52
+ "split": "test",
53
+ "method": "kind_only",
54
+ "match_precision": null,
55
+ "match_recall": null,
56
+ "locator_accuracy": null,
57
+ "patch_fix_rate": null,
58
+ "unknown_rate": 0.0,
59
+ "baseline_extra": 1,
60
+ "verdict": "needs_review",
61
+ "n_resources": 3
62
+ },
63
+ {
64
+ "scenario_id": "S03",
65
+ "family": "runtime_escape",
66
+ "split": "development",
67
+ "method": "contextual_rules",
68
+ "match_precision": 1.0,
69
+ "match_recall": 1.0,
70
+ "locator_accuracy": 1.0,
71
+ "patch_fix_rate": 0.0,
72
+ "unknown_rate": 0.2,
73
+ "baseline_extra": 0,
74
+ "verdict": "needs_review",
75
+ "n_resources": 2
76
+ },
77
+ {
78
+ "scenario_id": "S03",
79
+ "family": "runtime_escape",
80
+ "split": "development",
81
+ "method": "kind_only",
82
+ "match_precision": null,
83
+ "match_recall": null,
84
+ "locator_accuracy": null,
85
+ "patch_fix_rate": null,
86
+ "unknown_rate": 0.0,
87
+ "baseline_extra": 0,
88
+ "verdict": "needs_review",
89
+ "n_resources": 2
90
+ },
91
+ {
92
+ "scenario_id": "S04",
93
+ "family": "missing_user",
94
+ "split": "test",
95
+ "method": "contextual_rules",
96
+ "match_precision": 1.0,
97
+ "match_recall": 1.0,
98
+ "locator_accuracy": 1.0,
99
+ "patch_fix_rate": null,
100
+ "unknown_rate": 1.0,
101
+ "baseline_extra": 0,
102
+ "verdict": "needs_review",
103
+ "n_resources": 3
104
+ },
105
+ {
106
+ "scenario_id": "S04",
107
+ "family": "missing_user",
108
+ "split": "test",
109
+ "method": "kind_only",
110
+ "match_precision": null,
111
+ "match_recall": null,
112
+ "locator_accuracy": null,
113
+ "patch_fix_rate": null,
114
+ "unknown_rate": 0.0,
115
+ "baseline_extra": 0,
116
+ "verdict": "needs_review",
117
+ "n_resources": 3
118
+ },
119
+ {
120
+ "scenario_id": "S05",
121
+ "family": "build_hygiene",
122
+ "split": "test",
123
+ "method": "contextual_rules",
124
+ "match_precision": 1.0,
125
+ "match_recall": 1.0,
126
+ "locator_accuracy": 1.0,
127
+ "patch_fix_rate": 1.0,
128
+ "unknown_rate": 0.0,
129
+ "baseline_extra": 0,
130
+ "verdict": "needs_review",
131
+ "n_resources": 2
132
+ },
133
+ {
134
+ "scenario_id": "S05",
135
+ "family": "build_hygiene",
136
+ "split": "test",
137
+ "method": "kind_only",
138
+ "match_precision": null,
139
+ "match_recall": null,
140
+ "locator_accuracy": null,
141
+ "patch_fix_rate": null,
142
+ "unknown_rate": 0.0,
143
+ "baseline_extra": 0,
144
+ "verdict": "needs_review",
145
+ "n_resources": 2
146
+ }
147
+ ],
148
+ "sample_kpis": {
149
+ "n_files": 3,
150
+ "n_resources": 3,
151
+ "n_workloads": 2,
152
+ "n_findings_review": 8,
153
+ "n_fail": 7,
154
+ "n_unknown": 1,
155
+ "n_educational": 4,
156
+ "n_dropped": 0,
157
+ "coverage": 1.0,
158
+ "match_precision": 1.0,
159
+ "match_recall": 1.0,
160
+ "locator_accuracy": 1.0,
161
+ "patch_fix_rate": 1.0,
162
+ "patch_regression": 0,
163
+ "baseline_extra": 1,
164
+ "elapsed_ms": 35,
165
+ "engine_profile": "dockerfile-compose-inspect",
166
+ "n_build": 1,
167
+ "n_runtime": 7,
168
+ "n_dependency": 2
169
+ }
170
+ }
data/expected.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "S01": {
3
+ "fail": [
4
+ "IMG-USER-ROOT:Dockerfile#final",
5
+ "IMG-RT-PRIVILEGED:compose/shop-web",
6
+ "IMG-RT-HOST-NET:compose/shop-web",
7
+ "IMG-RT-DOCKER-SOCK:compose/shop-web",
8
+ "IMG-RT-USER-ROOT:compose/shop-web",
9
+ "IMG-META-USER-ROOT:inspect/shop-web",
10
+ "IMG-META-PRIVILEGED:inspect/shop-web"
11
+ ],
12
+ "unknown": [
13
+ "IMG-RT-NO-NEW-PRIVS:compose/shop-web"
14
+ ],
15
+ "baseline_false_positive": "compose/shop-web"
16
+ },
17
+ "S02": {
18
+ "fail": [],
19
+ "unknown": [],
20
+ "baseline_false_positive": "compose/shop-web"
21
+ },
22
+ "S03": {
23
+ "fail": [
24
+ "IMG-RT-CAPS:compose/worker",
25
+ "IMG-RT-PID-HOST:compose/worker",
26
+ "IMG-RT-DOCKER-SOCK:compose/worker",
27
+ "IMG-RT-SECCOMP:compose/worker"
28
+ ],
29
+ "unknown": [
30
+ "IMG-RT-NO-NEW-PRIVS:compose/worker"
31
+ ]
32
+ },
33
+ "S04": {
34
+ "fail": [],
35
+ "unknown": [
36
+ "IMG-USER-MISSING:Dockerfile#final",
37
+ "IMG-RT-USER-UNKNOWN:compose/api",
38
+ "IMG-META-USER-UNKNOWN:inspect/api"
39
+ ]
40
+ },
41
+ "S05": {
42
+ "fail": [
43
+ "IMG-SECRET-ARG:Dockerfile#final#ARG.GITHUB_TOKEN",
44
+ "IMG-SECRET-ARG:Dockerfile#final#ENV.API_KEY",
45
+ "IMG-ADD-COPY:Dockerfile#final#ADD",
46
+ "IMG-CURL-PIPE:Dockerfile#final#RUN.pipe",
47
+ "IMG-CHMOD-777:Dockerfile#final#RUN.chmod",
48
+ "IMG-SUDO:Dockerfile#final#RUN.sudo"
49
+ ],
50
+ "unknown": []
51
+ }
52
+ }
data/sample_preview.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "run_id": "image-7c3563ca36d4b36d",
3
+ "status": "needs_review",
4
+ "status_label": "Needs review \u2014 findings or unknowns are present",
5
+ "kpis": {
6
+ "n_files": 3,
7
+ "n_resources": 3,
8
+ "n_workloads": 2,
9
+ "n_findings_review": 8,
10
+ "n_fail": 7,
11
+ "n_unknown": 1,
12
+ "n_educational": 4,
13
+ "n_dropped": 0,
14
+ "coverage": 1.0,
15
+ "match_precision": 1.0,
16
+ "match_recall": 1.0,
17
+ "locator_accuracy": 1.0,
18
+ "patch_fix_rate": 1.0,
19
+ "patch_regression": 0,
20
+ "baseline_extra": 1,
21
+ "elapsed_ms": 35,
22
+ "engine_profile": "dockerfile-compose-inspect",
23
+ "n_build": 1,
24
+ "n_runtime": 7,
25
+ "n_dependency": 2
26
+ },
27
+ "kpi_html": "<div class='kpi-grid'><article class='kpi-card'><p class='kpi-label'>Findings to review</p><p class='kpi-value'>8</p><p class='kpi-sub'>Contextual rules \u00b7 fail 7</p></article><article class='kpi-card'><p class='kpi-label'>Object coverage</p><p class='kpi-value'>100%</p><p class='kpi-sub'>3 objects</p></article><article class='kpi-card'><p class='kpi-label'>Unknown items</p><p class='kpi-value'>1</p><p class='kpi-sub'>edu 4</p></article><article class='kpi-card'><p class='kpi-label'>Failed controls</p><p class='kpi-value'>7</p><p class='kpi-sub'>Kind-only baseline extras: 1</p></article><article class='kpi-card'><p class='kpi-label'>Analysis time</p><p class='kpi-value'>35 ms</p><p class='kpi-sub'>build 1 \u00b7 runtime 7 \u00b7 dep 2</p></article></div>",
28
+ "validation_ok": true,
29
+ "precomputed": true
30
+ }
data/scenarios.jsonl ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {"scenario_id": "S01", "family": "privileged_runtime", "split": "development", "title": "Root image plus privileged shop web", "title_fa": "تصویر ریشه و وب فروشگاه privileged", "description": "shop-web Dockerfile uses USER root and nginx:latest. Compose is privileged, host-networked, runs as user 0, and mounts docker.sock. Inspect metadata repeats root + privileged. Missing no-new-privileges stays unknown. Package CVEs are not scored here.", "description_fa": "Dockerfile فروشگاه USER root و nginx:latest دارد. Compose حالت privileged، شبکه میزبان، user صفر و mount سوکت داکر دارد. inspect همان ریشه و privileged را تکرار می‌کند. نبود no-new-privileges unknown است. CVE بسته اینجا امتیاز نمی‌گیرد.", "files": ["Dockerfile", "compose.yaml", "inspect.json"], "expected": {"fail": ["IMG-USER-ROOT:Dockerfile#final", "IMG-RT-PRIVILEGED:compose/shop-web", "IMG-RT-HOST-NET:compose/shop-web", "IMG-RT-DOCKER-SOCK:compose/shop-web", "IMG-RT-USER-ROOT:compose/shop-web", "IMG-META-USER-ROOT:inspect/shop-web", "IMG-META-PRIVILEGED:inspect/shop-web"], "unknown": ["IMG-RT-NO-NEW-PRIVS:compose/shop-web"], "baseline_false_positive": "compose/shop-web"}}
2
+ {"scenario_id": "S02", "family": "benign_lookalike", "split": "test", "title": "Hardened shop lookalike", "title_fa": "فروشگاه سخت‌شده با همان نام‌ها", "description": "Same shop-web names, but USER 1000, digest-pinned FROM, HEALTHCHECK, read_only, cap_drop ALL, and no-new-privileges. Kind-only baseline still flags the Dockerfile and Compose service. SBOM/CVE remains a separate educational note.", "description_fa": "همان نام shop-web اما USER ۱۰۰۰، FROM با digest، HEALTHCHECK، read_only، cap_drop ALL و no-new-privileges. خط مبنای نوع‌محور هنوز Dockerfile و سرویس را پرچم می‌زند. SBOM/CVE یادداشت جداست.", "files": ["Dockerfile", "compose.yaml", "inspect.json"], "expected": {"fail": [], "unknown": [], "baseline_false_positive": "compose/shop-web"}}
3
+ {"scenario_id": "S03", "family": "runtime_escape", "split": "development", "title": "Socket, capabilities, and host PID", "title_fa": "سوکت، قابلیت و PID میزبان", "description": "Build USER is 1000. Runtime adds SYS_ADMIN and NET_ADMIN, uses pid: host, mounts docker.sock, and sets seccomp:unconfined. no-new-privileges is still unknown.", "description_fa": "USER ساخت ۱۰۰۰ است. زمان اجرا SYS_ADMIN و NET_ADMIN، pid میزبان، سوکت داکر و seccomp:unconfined دارد. no-new-privileges همچنان unknown است.", "files": ["Dockerfile", "compose.yaml"], "expected": {"fail": ["IMG-RT-CAPS:compose/worker", "IMG-RT-PID-HOST:compose/worker", "IMG-RT-DOCKER-SOCK:compose/worker", "IMG-RT-SECCOMP:compose/worker"], "unknown": ["IMG-RT-NO-NEW-PRIVS:compose/worker"]}}
4
+ {"scenario_id": "S04", "family": "missing_user", "split": "test", "title": "Missing USER is not a runtime verdict", "title_fa": "نبود USER حکم زمان اجرا نیست", "description": "The Dockerfile has no USER. Compose and inspect also omit a user. All three stay unknown, not fail and not pass. A missing USER alone does not prove the runtime user.", "description_fa": "Dockerfile دستور USER ندارد. Compose و inspect هم user ندارند. هر سه unknown می‌مانند، نه fail و نه pass. نبود USER به‌تنهایی کاربر زمان اجرا را ثابت نمی‌کند.", "files": ["Dockerfile", "compose.yaml", "inspect.json"], "expected": {"fail": [], "unknown": ["IMG-USER-MISSING:Dockerfile#final", "IMG-RT-USER-UNKNOWN:compose/api", "IMG-META-USER-UNKNOWN:inspect/api"]}}
5
+ {"scenario_id": "S05", "family": "build_hygiene", "split": "test", "title": "Secrets, ADD, piped install, chmod 777", "title_fa": "راز، ADD، نصب لوله‌ای و chmod ۷۷۷", "description": "Runtime Compose is already non-root. The Dockerfile still uses secret-like ARG/ENV, ADD, curl|sh, chmod 777, and sudo.", "description_fa": "Compose زمان اجرا غیرریشه است. Dockerfile هنوز ARG/ENV شبیه راز، ADD، curl|sh، chmod ۷۷۷ و sudo دارد.", "files": ["Dockerfile", "compose.yaml"], "expected": {"fail": ["IMG-SECRET-ARG:Dockerfile#final#ARG.GITHUB_TOKEN", "IMG-SECRET-ARG:Dockerfile#final#ENV.API_KEY", "IMG-ADD-COPY:Dockerfile#final#ADD", "IMG-CURL-PIPE:Dockerfile#final#RUN.pipe", "IMG-CHMOD-777:Dockerfile#final#RUN.chmod", "IMG-SUDO:Dockerfile#final#RUN.sudo"], "unknown": []}}
data/schema.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_id": "aria.image_guard.config_subset.v1",
3
+ "seed": 18,
4
+ "engine_profile": "dockerfile-compose-inspect",
5
+ "file_fields": [
6
+ "filename",
7
+ "kind",
8
+ "name",
9
+ "field_path",
10
+ "line"
11
+ ],
12
+ "finding_fields": [
13
+ "finding_id",
14
+ "control_id",
15
+ "hadolint_id",
16
+ "state",
17
+ "address",
18
+ "file",
19
+ "line",
20
+ "field_path",
21
+ "severity",
22
+ "family"
23
+ ]
24
+ }
data/splits.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "scenario_family",
3
+ "development_families": [
4
+ "privileged_runtime",
5
+ "runtime_escape"
6
+ ],
7
+ "test_families": [
8
+ "benign_lookalike",
9
+ "missing_user",
10
+ "build_hygiene"
11
+ ],
12
+ "seed": 18
13
+ }
data/stacks/s01/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM nginx:latest
2
+ WORKDIR /usr/share/nginx/html
3
+ COPY index.html .
4
+ USER root
5
+ EXPOSE 80
data/stacks/s01/compose.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ shop-web:
3
+ image: nginx:latest
4
+ user: "0"
5
+ privileged: true
6
+ network_mode: host
7
+ volumes:
8
+ - /var/run/docker.sock:/var/run/docker.sock
9
+ ports:
10
+ - "80:80"
data/stacks/s01/inspect.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Name": "shop-web",
3
+ "Config": {
4
+ "User": "0",
5
+ "Image": "nginx:latest"
6
+ },
7
+ "HostConfig": {
8
+ "Privileged": true,
9
+ "NetworkMode": "host",
10
+ "Binds": ["/var/run/docker.sock:/var/run/docker.sock"],
11
+ "SecurityOpt": []
12
+ },
13
+ "RootFS": {
14
+ "Layers": ["sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
15
+ }
16
+ }
data/stacks/s02/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM python:3.12-slim@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2
+ WORKDIR /app
3
+ COPY app.py .
4
+ USER 1000:1000
5
+ HEALTHCHECK CMD python -c "print('ok')"
data/stacks/s02/compose.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ shop-web:
3
+ image: python:3.12-slim@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4
+ user: "1000:1000"
5
+ read_only: true
6
+ cap_drop:
7
+ - ALL
8
+ security_opt:
9
+ - no-new-privileges:true
10
+ tmpfs:
11
+ - /tmp
data/stacks/s02/inspect.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Name": "shop-web",
3
+ "Config": {
4
+ "User": "1000:1000",
5
+ "Image": "python:3.12-slim@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
6
+ },
7
+ "HostConfig": {
8
+ "Privileged": false,
9
+ "ReadonlyRootfs": true,
10
+ "CapDrop": ["ALL"],
11
+ "SecurityOpt": ["no-new-privileges:true"]
12
+ }
13
+ }
data/stacks/s03/Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM alpine:3.20
2
+ WORKDIR /app
3
+ COPY worker.sh .
4
+ USER 1000
data/stacks/s03/compose.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ worker:
3
+ image: alpine:3.20
4
+ user: "1000"
5
+ cap_add:
6
+ - SYS_ADMIN
7
+ - NET_ADMIN
8
+ pid: host
9
+ volumes:
10
+ - /var/run/docker.sock:/var/run/docker.sock
11
+ security_opt:
12
+ - seccomp:unconfined
data/stacks/s04/Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+ WORKDIR /app
3
+ COPY app.py .
4
+ HEALTHCHECK CMD python -c "print('ok')"
data/stacks/s04/compose.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ api:
3
+ image: python:3.12-slim
4
+ read_only: true
5
+ cap_drop:
6
+ - ALL
7
+ security_opt:
8
+ - no-new-privileges:true
data/stacks/s04/inspect.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Name": "api",
3
+ "Config": {
4
+ "User": "",
5
+ "Image": "python:3.12-slim"
6
+ },
7
+ "HostConfig": {
8
+ "Privileged": false
9
+ }
10
+ }
data/stacks/s05/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ARG GITHUB_TOKEN
3
+ ENV API_KEY=demo
4
+ WORKDIR /app
5
+ ADD src /app
6
+ RUN curl -fsSL https://example.invalid/install.sh | sh
7
+ RUN chmod 777 /app
8
+ RUN apt-get update && apt-get install -y sudo
9
+ USER 1000
data/stacks/s05/compose.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ builder:
3
+ image: ubuntu:24.04
4
+ user: "1000"
5
+ read_only: true
6
+ cap_drop:
7
+ - ALL
8
+ security_opt:
9
+ - no-new-privileges:true
demo/.gitattributes ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * text=auto eol=lf
2
+ *.py text eol=lf
3
+ *.md text eol=lf
4
+ *.csv text eol=lf
5
+ *.json text eol=lf
6
+ *.jsonl text eol=lf
7
+ *.yml text eol=lf
8
+ *.yaml text eol=lf
9
+ *.html text eol=lf
10
+ *.txt text eol=lf
11
+ *.log text eol=lf
demo/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .venv/
5
+ .venv-image/
6
+ *.egg-info/
7
+ .DS_Store
8
+ reports/
demo/LICENSE ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Aria AI
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
demo/README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: AriaImageGuard Container Hardening
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 6.15.1
8
+ app_file: app.py
9
+ fullWidth: true
10
+ python_version: "3.12"
11
+ short_description: Review Dockerfile and Compose; a missing USER is not runtime
12
+ pinned: true
13
+ license: apache-2.0
14
+ tags:
15
+ - cybersecurity
16
+ - container-security
17
+ - dockerfile
18
+ - code-generation
19
+ - configuration-review
20
+ datasets:
21
+ - AriaAICompany/image-guard-lab
22
+ ---
23
+
24
+ # AriaImageGuard — Container Hardening Review
25
+
26
+ **Aria AI** workstation for DevSecOps. Review a **Dockerfile**, a Compose file, or **pre-generated** `docker inspect` JSON. Root USER, privileged runtime, host namespaces, and `docker.sock` mounts are called out with a file:line locator and a suggested diff. A missing USER stays **unknown**, not a complete runtime verdict. Package CVEs belong to **AriaSBOM** and stay a separate dimension.
27
+
28
+ The MVP accepts up to 20 text files. Twenty-four pinned controls follow a Hadolint / CIS Docker mapped subset. Hadolint, Docker, and Trivy are **not** executed. Images are never pulled, loaded, or started. A cleared warning is not a hardened-image certificate.
29
+
30
+ ## What you can do
31
+
32
+ 1. Run the privileged shop web, the hardened lookalike, socket/capability escape, the missing-USER case, or the secret/ADD/curl|sh build.
33
+ 2. Filter the **build / runtime / dependency** panes and hide unknown items.
34
+ 3. Open a finding to its locator, observed fact, inference, and functional impact of the suggested change.
35
+ 4. Compare contextual rules with the kind-only baseline that flags every Dockerfile and Compose service.
36
+ 5. Select remediations, re-scan the patched files, and download JSON/CSV plus patched files.
37
+
38
+ CPU only. No paid API. No image pull. This is not Terraform review (project 09), not Kubernetes review (project 17), and not SBOM/CVE triage (project 07).
39
+
40
+ ## Hosting
41
+
42
+ - Dataset (live): [AriaAICompany/image-guard-lab](https://huggingface.co/datasets/AriaAICompany/image-guard-lab)
43
+ - Collection: [Aria AI — Cybersecurity](https://huggingface.co/collections/AriaAICompany/aria-ai-cybersecurity-6ab01faa3995a3bb737b58a7)
44
+ - Live app: `alirezaaminzadeh/aria-image-guard` after the Hub daily Space-creation cap resets (`python scripts/publish.py`)
45
+ - Organization card: `AriaAICompany/aria-image-guard` (static; org Gradio needs Team/Enterprise)
46
+
47
+ ## Persian
48
+
49
+ آریایمیدگارد Dockerfile، Compose و JSON از پیش‌تولیدشده inspect را بررسی می‌کند. USER ریشه و privileged و سوکت داکر fail هستند. نبود USER unknown است نه حکم کامل زمان اجرا. CVE بسته متعلق به AriaSBOM است. تصویر هرگز دریافت یا اجرا نمی‌شود. diff قابل دانلود است؛ اعمال به daemon وجود ندارد.
50
+
51
+ ## Links
52
+
53
+ - [AriaAICompany](https://huggingface.co/AriaAICompany)
54
+ - [aria-ai.ir](https://aria-ai.ir/)
55
+ - Roadmap project 18 of 25
56
+ - [Hadolint](https://github.com/hadolint/hadolint)
57
+ - [Docker best practices](https://docs.docker.com/build/building/best-practices/)
demo/app.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from src.ui import CSS, build_demo
4
+
5
+ demo = build_demo()
6
+
7
+ if __name__ == "__main__":
8
+ demo.launch(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="emerald"), css=CSS)
demo/evaluations/evaluation.json ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 18,
3
+ "n_scenarios": 5,
4
+ "n_controls": 24,
5
+ "engine_profile": "dockerfile-compose-inspect",
6
+ "rows": [
7
+ {
8
+ "scenario_id": "S01",
9
+ "family": "privileged_runtime",
10
+ "split": "development",
11
+ "method": "contextual_rules",
12
+ "match_precision": 1.0,
13
+ "match_recall": 1.0,
14
+ "locator_accuracy": 1.0,
15
+ "patch_fix_rate": 1.0,
16
+ "unknown_rate": 0.125,
17
+ "baseline_extra": 1,
18
+ "verdict": "needs_review",
19
+ "n_resources": 3
20
+ },
21
+ {
22
+ "scenario_id": "S01",
23
+ "family": "privileged_runtime",
24
+ "split": "development",
25
+ "method": "kind_only",
26
+ "match_precision": null,
27
+ "match_recall": null,
28
+ "locator_accuracy": null,
29
+ "patch_fix_rate": null,
30
+ "unknown_rate": 0.0,
31
+ "baseline_extra": 1,
32
+ "verdict": "needs_review",
33
+ "n_resources": 3
34
+ },
35
+ {
36
+ "scenario_id": "S02",
37
+ "family": "benign_lookalike",
38
+ "split": "test",
39
+ "method": "contextual_rules",
40
+ "match_precision": 1.0,
41
+ "match_recall": 1.0,
42
+ "locator_accuracy": 1.0,
43
+ "patch_fix_rate": null,
44
+ "unknown_rate": 0.0,
45
+ "baseline_extra": 1,
46
+ "verdict": "needs_review",
47
+ "n_resources": 3
48
+ },
49
+ {
50
+ "scenario_id": "S02",
51
+ "family": "benign_lookalike",
52
+ "split": "test",
53
+ "method": "kind_only",
54
+ "match_precision": null,
55
+ "match_recall": null,
56
+ "locator_accuracy": null,
57
+ "patch_fix_rate": null,
58
+ "unknown_rate": 0.0,
59
+ "baseline_extra": 1,
60
+ "verdict": "needs_review",
61
+ "n_resources": 3
62
+ },
63
+ {
64
+ "scenario_id": "S03",
65
+ "family": "runtime_escape",
66
+ "split": "development",
67
+ "method": "contextual_rules",
68
+ "match_precision": 1.0,
69
+ "match_recall": 1.0,
70
+ "locator_accuracy": 1.0,
71
+ "patch_fix_rate": 0.0,
72
+ "unknown_rate": 0.2,
73
+ "baseline_extra": 0,
74
+ "verdict": "needs_review",
75
+ "n_resources": 2
76
+ },
77
+ {
78
+ "scenario_id": "S03",
79
+ "family": "runtime_escape",
80
+ "split": "development",
81
+ "method": "kind_only",
82
+ "match_precision": null,
83
+ "match_recall": null,
84
+ "locator_accuracy": null,
85
+ "patch_fix_rate": null,
86
+ "unknown_rate": 0.0,
87
+ "baseline_extra": 0,
88
+ "verdict": "needs_review",
89
+ "n_resources": 2
90
+ },
91
+ {
92
+ "scenario_id": "S04",
93
+ "family": "missing_user",
94
+ "split": "test",
95
+ "method": "contextual_rules",
96
+ "match_precision": 1.0,
97
+ "match_recall": 1.0,
98
+ "locator_accuracy": 1.0,
99
+ "patch_fix_rate": null,
100
+ "unknown_rate": 1.0,
101
+ "baseline_extra": 0,
102
+ "verdict": "needs_review",
103
+ "n_resources": 3
104
+ },
105
+ {
106
+ "scenario_id": "S04",
107
+ "family": "missing_user",
108
+ "split": "test",
109
+ "method": "kind_only",
110
+ "match_precision": null,
111
+ "match_recall": null,
112
+ "locator_accuracy": null,
113
+ "patch_fix_rate": null,
114
+ "unknown_rate": 0.0,
115
+ "baseline_extra": 0,
116
+ "verdict": "needs_review",
117
+ "n_resources": 3
118
+ },
119
+ {
120
+ "scenario_id": "S05",
121
+ "family": "build_hygiene",
122
+ "split": "test",
123
+ "method": "contextual_rules",
124
+ "match_precision": 1.0,
125
+ "match_recall": 1.0,
126
+ "locator_accuracy": 1.0,
127
+ "patch_fix_rate": 1.0,
128
+ "unknown_rate": 0.0,
129
+ "baseline_extra": 0,
130
+ "verdict": "needs_review",
131
+ "n_resources": 2
132
+ },
133
+ {
134
+ "scenario_id": "S05",
135
+ "family": "build_hygiene",
136
+ "split": "test",
137
+ "method": "kind_only",
138
+ "match_precision": null,
139
+ "match_recall": null,
140
+ "locator_accuracy": null,
141
+ "patch_fix_rate": null,
142
+ "unknown_rate": 0.0,
143
+ "baseline_extra": 0,
144
+ "verdict": "needs_review",
145
+ "n_resources": 2
146
+ }
147
+ ],
148
+ "sample_kpis": {
149
+ "n_files": 3,
150
+ "n_resources": 3,
151
+ "n_workloads": 2,
152
+ "n_findings_review": 8,
153
+ "n_fail": 7,
154
+ "n_unknown": 1,
155
+ "n_educational": 4,
156
+ "n_dropped": 0,
157
+ "coverage": 1.0,
158
+ "match_precision": 1.0,
159
+ "match_recall": 1.0,
160
+ "locator_accuracy": 1.0,
161
+ "patch_fix_rate": 1.0,
162
+ "patch_regression": 0,
163
+ "baseline_extra": 1,
164
+ "elapsed_ms": 35,
165
+ "engine_profile": "dockerfile-compose-inspect",
166
+ "n_build": 1,
167
+ "n_runtime": 7,
168
+ "n_dependency": 2
169
+ }
170
+ }
demo/examples/controls.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "ruleset_id": "hadolint-cis-docker-mapped-v1",
3
+ "date": "2026-09-20",
4
+ "n_controls": 24,
5
+ "engine_profile": "dockerfile-compose-inspect",
6
+ "note": "Hadolint and Docker are not executed. CVE/SBOM is project 07."
7
+ }
demo/examples/evaluation.json ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 18,
3
+ "n_scenarios": 5,
4
+ "n_controls": 24,
5
+ "engine_profile": "dockerfile-compose-inspect",
6
+ "rows": [
7
+ {
8
+ "scenario_id": "S01",
9
+ "family": "privileged_runtime",
10
+ "split": "development",
11
+ "method": "contextual_rules",
12
+ "match_precision": 1.0,
13
+ "match_recall": 1.0,
14
+ "locator_accuracy": 1.0,
15
+ "patch_fix_rate": 1.0,
16
+ "unknown_rate": 0.125,
17
+ "baseline_extra": 1,
18
+ "verdict": "needs_review",
19
+ "n_resources": 3
20
+ },
21
+ {
22
+ "scenario_id": "S01",
23
+ "family": "privileged_runtime",
24
+ "split": "development",
25
+ "method": "kind_only",
26
+ "match_precision": null,
27
+ "match_recall": null,
28
+ "locator_accuracy": null,
29
+ "patch_fix_rate": null,
30
+ "unknown_rate": 0.0,
31
+ "baseline_extra": 1,
32
+ "verdict": "needs_review",
33
+ "n_resources": 3
34
+ },
35
+ {
36
+ "scenario_id": "S02",
37
+ "family": "benign_lookalike",
38
+ "split": "test",
39
+ "method": "contextual_rules",
40
+ "match_precision": 1.0,
41
+ "match_recall": 1.0,
42
+ "locator_accuracy": 1.0,
43
+ "patch_fix_rate": null,
44
+ "unknown_rate": 0.0,
45
+ "baseline_extra": 1,
46
+ "verdict": "needs_review",
47
+ "n_resources": 3
48
+ },
49
+ {
50
+ "scenario_id": "S02",
51
+ "family": "benign_lookalike",
52
+ "split": "test",
53
+ "method": "kind_only",
54
+ "match_precision": null,
55
+ "match_recall": null,
56
+ "locator_accuracy": null,
57
+ "patch_fix_rate": null,
58
+ "unknown_rate": 0.0,
59
+ "baseline_extra": 1,
60
+ "verdict": "needs_review",
61
+ "n_resources": 3
62
+ },
63
+ {
64
+ "scenario_id": "S03",
65
+ "family": "runtime_escape",
66
+ "split": "development",
67
+ "method": "contextual_rules",
68
+ "match_precision": 1.0,
69
+ "match_recall": 1.0,
70
+ "locator_accuracy": 1.0,
71
+ "patch_fix_rate": 0.0,
72
+ "unknown_rate": 0.2,
73
+ "baseline_extra": 0,
74
+ "verdict": "needs_review",
75
+ "n_resources": 2
76
+ },
77
+ {
78
+ "scenario_id": "S03",
79
+ "family": "runtime_escape",
80
+ "split": "development",
81
+ "method": "kind_only",
82
+ "match_precision": null,
83
+ "match_recall": null,
84
+ "locator_accuracy": null,
85
+ "patch_fix_rate": null,
86
+ "unknown_rate": 0.0,
87
+ "baseline_extra": 0,
88
+ "verdict": "needs_review",
89
+ "n_resources": 2
90
+ },
91
+ {
92
+ "scenario_id": "S04",
93
+ "family": "missing_user",
94
+ "split": "test",
95
+ "method": "contextual_rules",
96
+ "match_precision": 1.0,
97
+ "match_recall": 1.0,
98
+ "locator_accuracy": 1.0,
99
+ "patch_fix_rate": null,
100
+ "unknown_rate": 1.0,
101
+ "baseline_extra": 0,
102
+ "verdict": "needs_review",
103
+ "n_resources": 3
104
+ },
105
+ {
106
+ "scenario_id": "S04",
107
+ "family": "missing_user",
108
+ "split": "test",
109
+ "method": "kind_only",
110
+ "match_precision": null,
111
+ "match_recall": null,
112
+ "locator_accuracy": null,
113
+ "patch_fix_rate": null,
114
+ "unknown_rate": 0.0,
115
+ "baseline_extra": 0,
116
+ "verdict": "needs_review",
117
+ "n_resources": 3
118
+ },
119
+ {
120
+ "scenario_id": "S05",
121
+ "family": "build_hygiene",
122
+ "split": "test",
123
+ "method": "contextual_rules",
124
+ "match_precision": 1.0,
125
+ "match_recall": 1.0,
126
+ "locator_accuracy": 1.0,
127
+ "patch_fix_rate": 1.0,
128
+ "unknown_rate": 0.0,
129
+ "baseline_extra": 0,
130
+ "verdict": "needs_review",
131
+ "n_resources": 2
132
+ },
133
+ {
134
+ "scenario_id": "S05",
135
+ "family": "build_hygiene",
136
+ "split": "test",
137
+ "method": "kind_only",
138
+ "match_precision": null,
139
+ "match_recall": null,
140
+ "locator_accuracy": null,
141
+ "patch_fix_rate": null,
142
+ "unknown_rate": 0.0,
143
+ "baseline_extra": 0,
144
+ "verdict": "needs_review",
145
+ "n_resources": 2
146
+ }
147
+ ],
148
+ "sample_kpis": {
149
+ "n_files": 3,
150
+ "n_resources": 3,
151
+ "n_workloads": 2,
152
+ "n_findings_review": 8,
153
+ "n_fail": 7,
154
+ "n_unknown": 1,
155
+ "n_educational": 4,
156
+ "n_dropped": 0,
157
+ "coverage": 1.0,
158
+ "match_precision": 1.0,
159
+ "match_recall": 1.0,
160
+ "locator_accuracy": 1.0,
161
+ "patch_fix_rate": 1.0,
162
+ "patch_regression": 0,
163
+ "baseline_extra": 1,
164
+ "elapsed_ms": 35,
165
+ "engine_profile": "dockerfile-compose-inspect",
166
+ "n_build": 1,
167
+ "n_runtime": 7,
168
+ "n_dependency": 2
169
+ }
170
+ }
demo/examples/expected.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "S01": {
3
+ "fail": [
4
+ "IMG-USER-ROOT:Dockerfile#final",
5
+ "IMG-RT-PRIVILEGED:compose/shop-web",
6
+ "IMG-RT-HOST-NET:compose/shop-web",
7
+ "IMG-RT-DOCKER-SOCK:compose/shop-web",
8
+ "IMG-RT-USER-ROOT:compose/shop-web",
9
+ "IMG-META-USER-ROOT:inspect/shop-web",
10
+ "IMG-META-PRIVILEGED:inspect/shop-web"
11
+ ],
12
+ "unknown": [
13
+ "IMG-RT-NO-NEW-PRIVS:compose/shop-web"
14
+ ],
15
+ "baseline_false_positive": "compose/shop-web"
16
+ },
17
+ "S02": {
18
+ "fail": [],
19
+ "unknown": [],
20
+ "baseline_false_positive": "compose/shop-web"
21
+ },
22
+ "S03": {
23
+ "fail": [
24
+ "IMG-RT-CAPS:compose/worker",
25
+ "IMG-RT-PID-HOST:compose/worker",
26
+ "IMG-RT-DOCKER-SOCK:compose/worker",
27
+ "IMG-RT-SECCOMP:compose/worker"
28
+ ],
29
+ "unknown": [
30
+ "IMG-RT-NO-NEW-PRIVS:compose/worker"
31
+ ]
32
+ },
33
+ "S04": {
34
+ "fail": [],
35
+ "unknown": [
36
+ "IMG-USER-MISSING:Dockerfile#final",
37
+ "IMG-RT-USER-UNKNOWN:compose/api",
38
+ "IMG-META-USER-UNKNOWN:inspect/api"
39
+ ]
40
+ },
41
+ "S05": {
42
+ "fail": [
43
+ "IMG-SECRET-ARG:Dockerfile#final#ARG.GITHUB_TOKEN",
44
+ "IMG-SECRET-ARG:Dockerfile#final#ENV.API_KEY",
45
+ "IMG-ADD-COPY:Dockerfile#final#ADD",
46
+ "IMG-CURL-PIPE:Dockerfile#final#RUN.pipe",
47
+ "IMG-CHMOD-777:Dockerfile#final#RUN.chmod",
48
+ "IMG-SUDO:Dockerfile#final#RUN.sudo"
49
+ ],
50
+ "unknown": []
51
+ }
52
+ }
demo/examples/sample_preview.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "run_id": "image-7c3563ca36d4b36d",
3
+ "status": "needs_review",
4
+ "status_label": "Needs review \u2014 findings or unknowns are present",
5
+ "kpis": {
6
+ "n_files": 3,
7
+ "n_resources": 3,
8
+ "n_workloads": 2,
9
+ "n_findings_review": 8,
10
+ "n_fail": 7,
11
+ "n_unknown": 1,
12
+ "n_educational": 4,
13
+ "n_dropped": 0,
14
+ "coverage": 1.0,
15
+ "match_precision": 1.0,
16
+ "match_recall": 1.0,
17
+ "locator_accuracy": 1.0,
18
+ "patch_fix_rate": 1.0,
19
+ "patch_regression": 0,
20
+ "baseline_extra": 1,
21
+ "elapsed_ms": 35,
22
+ "engine_profile": "dockerfile-compose-inspect",
23
+ "n_build": 1,
24
+ "n_runtime": 7,
25
+ "n_dependency": 2
26
+ },
27
+ "kpi_html": "<div class='kpi-grid'><article class='kpi-card'><p class='kpi-label'>Findings to review</p><p class='kpi-value'>8</p><p class='kpi-sub'>Contextual rules \u00b7 fail 7</p></article><article class='kpi-card'><p class='kpi-label'>Object coverage</p><p class='kpi-value'>100%</p><p class='kpi-sub'>3 objects</p></article><article class='kpi-card'><p class='kpi-label'>Unknown items</p><p class='kpi-value'>1</p><p class='kpi-sub'>edu 4</p></article><article class='kpi-card'><p class='kpi-label'>Failed controls</p><p class='kpi-value'>7</p><p class='kpi-sub'>Kind-only baseline extras: 1</p></article><article class='kpi-card'><p class='kpi-label'>Analysis time</p><p class='kpi-value'>35 ms</p><p class='kpi-sub'>build 1 \u00b7 runtime 7 \u00b7 dep 2</p></article></div>",
28
+ "validation_ok": true,
29
+ "precomputed": true
30
+ }
demo/examples/scenarios.jsonl ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {"scenario_id": "S01", "family": "privileged_runtime", "split": "development", "title": "Root image plus privileged shop web", "title_fa": "تصویر ریشه و وب فروشگاه privileged", "description": "shop-web Dockerfile uses USER root and nginx:latest. Compose is privileged, host-networked, runs as user 0, and mounts docker.sock. Inspect metadata repeats root + privileged. Missing no-new-privileges stays unknown. Package CVEs are not scored here.", "description_fa": "Dockerfile فروشگاه USER root و nginx:latest دارد. Compose حالت privileged، شبکه میزبان، user صفر و mount سوکت داکر دارد. inspect همان ریشه و privileged را تکرار می‌کند. نبود no-new-privileges unknown است. CVE بسته اینجا امتیاز نمی‌گیرد.", "files": ["Dockerfile", "compose.yaml", "inspect.json"], "expected": {"fail": ["IMG-USER-ROOT:Dockerfile#final", "IMG-RT-PRIVILEGED:compose/shop-web", "IMG-RT-HOST-NET:compose/shop-web", "IMG-RT-DOCKER-SOCK:compose/shop-web", "IMG-RT-USER-ROOT:compose/shop-web", "IMG-META-USER-ROOT:inspect/shop-web", "IMG-META-PRIVILEGED:inspect/shop-web"], "unknown": ["IMG-RT-NO-NEW-PRIVS:compose/shop-web"], "baseline_false_positive": "compose/shop-web"}}
2
+ {"scenario_id": "S02", "family": "benign_lookalike", "split": "test", "title": "Hardened shop lookalike", "title_fa": "فروشگاه سخت‌شده با همان نام‌ها", "description": "Same shop-web names, but USER 1000, digest-pinned FROM, HEALTHCHECK, read_only, cap_drop ALL, and no-new-privileges. Kind-only baseline still flags the Dockerfile and Compose service. SBOM/CVE remains a separate educational note.", "description_fa": "همان نام shop-web اما USER ۱۰۰۰، FROM با digest، HEALTHCHECK، read_only، cap_drop ALL و no-new-privileges. خط مبنای نوع‌محور هنوز Dockerfile و سرویس را پرچم می‌زند. SBOM/CVE یادداشت جداست.", "files": ["Dockerfile", "compose.yaml", "inspect.json"], "expected": {"fail": [], "unknown": [], "baseline_false_positive": "compose/shop-web"}}
3
+ {"scenario_id": "S03", "family": "runtime_escape", "split": "development", "title": "Socket, capabilities, and host PID", "title_fa": "سوکت، قابلیت و PID میزبان", "description": "Build USER is 1000. Runtime adds SYS_ADMIN and NET_ADMIN, uses pid: host, mounts docker.sock, and sets seccomp:unconfined. no-new-privileges is still unknown.", "description_fa": "USER ساخت ۱۰۰۰ است. زمان اجرا SYS_ADMIN و NET_ADMIN، pid میزبان، سوکت داکر و seccomp:unconfined دارد. no-new-privileges همچنان unknown است.", "files": ["Dockerfile", "compose.yaml"], "expected": {"fail": ["IMG-RT-CAPS:compose/worker", "IMG-RT-PID-HOST:compose/worker", "IMG-RT-DOCKER-SOCK:compose/worker", "IMG-RT-SECCOMP:compose/worker"], "unknown": ["IMG-RT-NO-NEW-PRIVS:compose/worker"]}}
4
+ {"scenario_id": "S04", "family": "missing_user", "split": "test", "title": "Missing USER is not a runtime verdict", "title_fa": "نبود USER حکم زمان اجرا نیست", "description": "The Dockerfile has no USER. Compose and inspect also omit a user. All three stay unknown, not fail and not pass. A missing USER alone does not prove the runtime user.", "description_fa": "Dockerfile دستور USER ندارد. Compose و inspect هم user ندارند. هر سه unknown می‌مانند، نه fail و نه pass. نبود USER به‌تنهایی کاربر زمان اجرا را ثابت نمی‌کند.", "files": ["Dockerfile", "compose.yaml", "inspect.json"], "expected": {"fail": [], "unknown": ["IMG-USER-MISSING:Dockerfile#final", "IMG-RT-USER-UNKNOWN:compose/api", "IMG-META-USER-UNKNOWN:inspect/api"]}}
5
+ {"scenario_id": "S05", "family": "build_hygiene", "split": "test", "title": "Secrets, ADD, piped install, chmod 777", "title_fa": "راز، ADD، نصب لوله‌ای و chmod ۷۷۷", "description": "Runtime Compose is already non-root. The Dockerfile still uses secret-like ARG/ENV, ADD, curl|sh, chmod 777, and sudo.", "description_fa": "Compose زمان اجرا غیرریشه است. Dockerfile هنوز ARG/ENV شبیه راز، ADD، curl|sh، chmod ۷۷۷ و sudo دارد.", "files": ["Dockerfile", "compose.yaml"], "expected": {"fail": ["IMG-SECRET-ARG:Dockerfile#final#ARG.GITHUB_TOKEN", "IMG-SECRET-ARG:Dockerfile#final#ENV.API_KEY", "IMG-ADD-COPY:Dockerfile#final#ADD", "IMG-CURL-PIPE:Dockerfile#final#RUN.pipe", "IMG-CHMOD-777:Dockerfile#final#RUN.chmod", "IMG-SUDO:Dockerfile#final#RUN.sudo"], "unknown": []}}
demo/examples/schema.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_id": "aria.image_guard.config_subset.v1",
3
+ "seed": 18,
4
+ "engine_profile": "dockerfile-compose-inspect",
5
+ "file_fields": [
6
+ "filename",
7
+ "kind",
8
+ "name",
9
+ "field_path",
10
+ "line"
11
+ ],
12
+ "finding_fields": [
13
+ "finding_id",
14
+ "control_id",
15
+ "hadolint_id",
16
+ "state",
17
+ "address",
18
+ "file",
19
+ "line",
20
+ "field_path",
21
+ "severity",
22
+ "family"
23
+ ]
24
+ }
demo/examples/splits.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "scenario_family",
3
+ "development_families": [
4
+ "privileged_runtime",
5
+ "runtime_escape"
6
+ ],
7
+ "test_families": [
8
+ "benign_lookalike",
9
+ "missing_user",
10
+ "build_hygiene"
11
+ ],
12
+ "seed": 18
13
+ }
demo/examples/stacks/s01/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM nginx:latest
2
+ WORKDIR /usr/share/nginx/html
3
+ COPY index.html .
4
+ USER root
5
+ EXPOSE 80
demo/examples/stacks/s01/compose.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ shop-web:
3
+ image: nginx:latest
4
+ user: "0"
5
+ privileged: true
6
+ network_mode: host
7
+ volumes:
8
+ - /var/run/docker.sock:/var/run/docker.sock
9
+ ports:
10
+ - "80:80"
demo/examples/stacks/s01/inspect.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Name": "shop-web",
3
+ "Config": {
4
+ "User": "0",
5
+ "Image": "nginx:latest"
6
+ },
7
+ "HostConfig": {
8
+ "Privileged": true,
9
+ "NetworkMode": "host",
10
+ "Binds": ["/var/run/docker.sock:/var/run/docker.sock"],
11
+ "SecurityOpt": []
12
+ },
13
+ "RootFS": {
14
+ "Layers": ["sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
15
+ }
16
+ }
demo/examples/stacks/s02/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM python:3.12-slim@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2
+ WORKDIR /app
3
+ COPY app.py .
4
+ USER 1000:1000
5
+ HEALTHCHECK CMD python -c "print('ok')"
demo/examples/stacks/s02/compose.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ shop-web:
3
+ image: python:3.12-slim@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4
+ user: "1000:1000"
5
+ read_only: true
6
+ cap_drop:
7
+ - ALL
8
+ security_opt:
9
+ - no-new-privileges:true
10
+ tmpfs:
11
+ - /tmp
demo/examples/stacks/s02/inspect.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Name": "shop-web",
3
+ "Config": {
4
+ "User": "1000:1000",
5
+ "Image": "python:3.12-slim@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
6
+ },
7
+ "HostConfig": {
8
+ "Privileged": false,
9
+ "ReadonlyRootfs": true,
10
+ "CapDrop": ["ALL"],
11
+ "SecurityOpt": ["no-new-privileges:true"]
12
+ }
13
+ }
demo/examples/stacks/s03/Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM alpine:3.20
2
+ WORKDIR /app
3
+ COPY worker.sh .
4
+ USER 1000
demo/examples/stacks/s03/compose.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ worker:
3
+ image: alpine:3.20
4
+ user: "1000"
5
+ cap_add:
6
+ - SYS_ADMIN
7
+ - NET_ADMIN
8
+ pid: host
9
+ volumes:
10
+ - /var/run/docker.sock:/var/run/docker.sock
11
+ security_opt:
12
+ - seccomp:unconfined
demo/examples/stacks/s04/Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+ WORKDIR /app
3
+ COPY app.py .
4
+ HEALTHCHECK CMD python -c "print('ok')"
demo/examples/stacks/s04/compose.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ api:
3
+ image: python:3.12-slim
4
+ read_only: true
5
+ cap_drop:
6
+ - ALL
7
+ security_opt:
8
+ - no-new-privileges:true
demo/examples/stacks/s04/inspect.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Name": "api",
3
+ "Config": {
4
+ "User": "",
5
+ "Image": "python:3.12-slim"
6
+ },
7
+ "HostConfig": {
8
+ "Privileged": false
9
+ }
10
+ }
demo/examples/stacks/s05/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:24.04
2
+ ARG GITHUB_TOKEN
3
+ ENV API_KEY=demo
4
+ WORKDIR /app
5
+ ADD src /app
6
+ RUN curl -fsSL https://example.invalid/install.sh | sh
7
+ RUN chmod 777 /app
8
+ RUN apt-get update && apt-get install -y sudo
9
+ USER 1000
demo/examples/stacks/s05/compose.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ builder:
3
+ image: ubuntu:24.04
4
+ user: "1000"
5
+ read_only: true
6
+ cap_drop:
7
+ - ALL
8
+ security_opt:
9
+ - no-new-privileges:true
demo/requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ pandas>=2.2.0,<3
2
+ pydantic>=2.6.0,<3
3
+ plotly>=5.24.0,<7
4
+ PyYAML>=6.0.2,<7
5
+ jsonschema>=4.23.0,<5
demo/src/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """AriaImageGuard — Dockerfile, Compose, and inspect-metadata hardening review."""
demo/src/baseline.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from src.domain import FindingState, Method
4
+ from src.index import ConfigIndex
5
+ from src.parser import snippet_around
6
+ from src.schemas import Finding
7
+
8
+
9
+ def kind_only_findings(index: ConfigIndex) -> list[Finding]:
10
+ out: list[Finding] = []
11
+ for obj in index.final_dockerfiles():
12
+ out.append(
13
+ _flag(
14
+ obj,
15
+ "IMG-USER-ROOT",
16
+ "critical",
17
+ "Kind-only: every Dockerfile is flagged as a root USER.",
18
+ )
19
+ )
20
+ for obj in index.services():
21
+ out.append(
22
+ _flag(
23
+ obj,
24
+ "IMG-RT-PRIVILEGED",
25
+ "critical",
26
+ "Kind-only: every Compose service is flagged as privileged.",
27
+ )
28
+ )
29
+ return out
30
+
31
+
32
+ def _flag(obj, control_id: str, severity: str, observed: str) -> Finding:
33
+ return Finding(
34
+ finding_id=f"baseline:{obj.address}",
35
+ control_id=control_id,
36
+ hadolint_id="KIND_ONLY",
37
+ title=f"Kind-only flag for {obj.kind.value}",
38
+ family="baseline",
39
+ severity=severity,
40
+ state=FindingState.FAIL,
41
+ method=Method.BASELINE.value,
42
+ resource_kind=obj.kind.value,
43
+ resource_name=obj.name,
44
+ address=obj.address,
45
+ file=obj.file,
46
+ line=obj.start_line,
47
+ end_line=obj.end_line,
48
+ field_path="kind",
49
+ locator=f"{obj.file}:{obj.start_line}:kind",
50
+ observed=observed,
51
+ inference="The baseline ignores USER, capabilities, mounts, and inspect metadata.",
52
+ action="Do not treat a file kind as proof of exposure or hardening.",
53
+ reference="aria-image-guard://baseline/kind-only",
54
+ snippet=snippet_around(obj, obj.start_line),
55
+ confidence="kind_only",
56
+ )