Commit b8a3ffa
committed
feat(cli): accept an archive of dranzer reports as one material
A single dranzer run emits one report per test mode (-b, -p, -s, -t), so the
evidence arrives as a bundle rather than a single file. CERTCC_DRANZER now
accepts either a single report or a zip/tar.gz of them, following the
RADAMSA_CRASHES precedent: the archive is recorded whole under the contract's
declared material name, with the report count as an annotation.
Recording the archive alone is not enough, because the policy engine reads
dranzer content: parsing archive bytes as text yields an empty report, which
makes the ActiveX policy skip rather than evaluate and reads as a clean run.
The projection therefore aggregates the archive's entries, summing every
counter and unioning objects and findings, and keeps a per-report breakdown
alongside. The aggregate is promoted to the top level so existing policies
reading tool, summary and findings are unaffected.
Craft time and evaluation time share both predicates -- what counts as an
archive and what counts as a report -- because a disagreement would accept a
material whose projection then silently skips. Container detection is by content
on both sides for the same reason: a zip carrying a prepended stub still opens,
since its central directory is at the end, but no longer starts with the zip
magic, so detecting by filename at craft time would accept what the projection
cannot read.
Archive container detection and walking move to a new archiveio leaf package so
the projection can share the entry-count, size and traversal guards with the
crafters without an import cycle. Those guards are also corrected: the size cap
reported its error alongside a full buffer, which io.ReadFull discards, so a
stream read in exact block sizes -- every tar header -- passed the limit
unreported; and entries skipped as directories or symlinks counted against
neither limit, letting a directory-only tar.gz decompress unmeasured.
LooksLikeDranzer now judges only what the parser extracted rather than the
presence of a phrase in the raw text. The CSV companion that ships beside real
reports quotes both the per-object banner and an error line inside its columns,
so a substring match accepted a file that yields no version, objects, findings or
counters -- which would then skip policy evaluation. Genuine reports put those
lines on their own line where the anchored patterns match them, and a parsed
counter counts even when zero, so a run that found no COM objects is still
recognized.
Container detection fills its peek buffer instead of trusting a single read,
since the tar marker sits at offset 257 and a short read would misdetect a valid
tar as a plain file, and it now surfaces read failures rather than reporting them
as "not an archive".
Refs PFM-6467
Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Chainloop-Trace-Sessions: 2b0a76d9-abe5-44af-919a-419aca1496531 parent c3e36e4 commit b8a3ffa
21 files changed
Lines changed: 1836 additions & 292 deletions
File tree
- app/controlplane/api
- gen/frontend/workflowcontract/v1
- workflowcontract/v1
- pkg/attestation/crafter
- api/attestation/v1
- testdata
- materials
- archiveio
- dranzer
- testdata/dranzer-bundle
Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
244 | 249 | | |
245 | 250 | | |
246 | 251 | | |
247 | | - | |
| 252 | + | |
248 | 253 | | |
249 | 254 | | |
250 | 255 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
334 | 370 | | |
335 | 371 | | |
336 | 372 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 19 | | |
25 | 20 | | |
26 | | - | |
27 | | - | |
28 | 21 | | |
29 | 22 | | |
30 | | - | |
31 | 23 | | |
32 | 24 | | |
| 25 | + | |
33 | 26 | | |
34 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
37 | 35 | | |
38 | 36 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
43 | 41 | | |
44 | 42 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 43 | + | |
| 44 | + | |
96 | 45 | | |
97 | 46 | | |
98 | 47 | | |
99 | 48 | | |
100 | | - | |
| 49 | + | |
101 | 50 | | |
102 | 51 | | |
103 | | - | |
| 52 | + | |
104 | 53 | | |
105 | | - | |
| 54 | + | |
106 | 55 | | |
107 | 56 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
112 | 61 | | |
113 | 62 | | |
114 | 63 | | |
115 | 64 | | |
116 | 65 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 66 | + | |
135 | 67 | | |
136 | 68 | | |
137 | 69 | | |
138 | 70 | | |
139 | 71 | | |
140 | 72 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 73 | + | |
268 | 74 | | |
269 | 75 | | |
270 | 76 | | |
271 | 77 | | |
272 | 78 | | |
273 | | - | |
274 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
275 | 95 | | |
276 | 96 | | |
277 | 97 | | |
| |||
0 commit comments