Commit d02437c
* lane 4A follow-up: classify non-dict input as unsupported, not legacy
Caught during a second adversarial sweep of the kernel adapter: the
``verify_commitment`` wrapper was coercing non-dict input to an empty dict
before handing it to the kernel. The kernel's empty-dict branch treats
``{}`` as a legacy envelope (missing ``spec_version``), so non-dict input
(``None``, lists, strings, scalars) was producing a result with
``spec_version_status="legacy"`` and ``legacy_envelope=True`` — labels that
read as "valid pre-spec_version envelope that failed signature" when the
truth is "this isn't a valid envelope shape at all."
``overall=False`` was correct in every case (the safety-relevant
guarantee), so this was a cosmetic, not a correctness, issue. But the
labels appear in CLI panels, logs, and audit-export JSON, so consistency
matters.
Two changes:
- Pass the envelope through to the kernel unchanged — the kernel handles
non-dict directly (returns ``legacy_envelope=False`` with errors
``["envelope is not a JSON object"]``), so the coercion was the bug.
- Fix the ``spec_version_status`` synth: non-dict input is ``unsupported``,
with ``reason="envelope_not_a_json_object"`` for diagnostics. The
trichotomy stays (``supported`` / ``legacy`` / ``unsupported``); only
malformed input gets the precise diagnostic ``reason``.
Parametrized regression test covers five non-dict shapes (None / [] /
"hello" / 42 / True). The pre-kernel in-tree code crashed with
``AttributeError`` on the same inputs, so this also locks in the soft-fail
improvement from the kernel migration.
Suite: 229 passed, 21 skipped. Cross-product green
(``TestCrossProductVerify`` + ``cross-product-verified-model`` E2E).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* verify_signature: propagate verify_commitment's precise reason field
Knock-on of the malformed-input label cleanup: ``verify_signature`` was
hardcoding ``reason="unsupported_spec_version"`` whenever ``spec_status``
came back as ``"unsupported"``, which now overwrites the more specific
``"envelope_not_a_json_object"`` diagnostic that ``verify_commitment``
emits for non-dict input. The fix is a one-line change — fall back to
the generic reason only when ``verify_commitment`` didn't supply one.
Regression test pins ``verify_signature(None, engine)["reason"]``.
Suite: 230 passed, 21 skipped.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2d858ea commit d02437c
3 files changed
Lines changed: 63 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
220 | 225 | | |
221 | | - | |
| 226 | + | |
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
226 | 234 | | |
227 | 235 | | |
228 | 236 | | |
229 | | - | |
230 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
231 | 243 | | |
232 | 244 | | |
233 | 245 | | |
| |||
240 | 252 | | |
241 | 253 | | |
242 | 254 | | |
243 | | - | |
| 255 | + | |
244 | 256 | | |
245 | 257 | | |
246 | 258 | | |
247 | 259 | | |
248 | 260 | | |
249 | | - | |
| 261 | + | |
250 | 262 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
483 | 487 | | |
484 | 488 | | |
485 | 489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
272 | 295 | | |
273 | 296 | | |
274 | 297 | | |
| |||
419 | 442 | | |
420 | 443 | | |
421 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
422 | 462 | | |
423 | 463 | | |
424 | 464 | | |
| |||
0 commit comments