Repository navigation
Commit 671c3a9
fix(assail): refuse an unwritable KYAML copy or sidecar before replacing the report (#274)
## Problem
Codex raised this on #264 after it merged. The
`--output-format kyaml` preflight looks each output up, but lookup does
not show that a path can be written. The run then replaces `report.json`
and only afterwards fails on the copy, leaving the new report beside
stale companions. Two inputs trigger this:
- a read-only `report.kyaml` or `report.attestation.json`;
- a directory the caller cannot create files in.
The preflight is meant to be all-or-nothing, and this breaks it.
## Change
- `kyaml_copy_path` now opens each output for writing during the
preflight, without truncating it. An absent output is created and then
removed again.
- The kernel makes the decision, so ACLs and ownership count, not only
mode bits.
- The CHANGELOG `[Unreleased]` entry for the KYAML copy notes this.
## Validation
Two new tests in `tests/coverage_php_tests.rs`: a read-only copy, and an
attested run into an unwritable directory. Each checks that the run
fails with "nothing was written" and that the old report is still there.
- Run as `nobody`, both **fail without the fix** and pass with it. All
13 `kyaml_output_format` tests pass.
- Root ignores permission bits, so as root the two tests detect that and
skip. GitHub runners run unprivileged, so CI exercises them.
- `cargo fmt --check` and `cargo clippy --all-targets -- -D warnings`
are clean, and `cargo test` passes all 24 suites.
Not covered here: the same problem in plain JSON mode with `--attest`
(report plus sidecar), which has never had a preflight. That is on the
follow-up list, and the planned generation-directory publish would close
it for every mode.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01PFaqv6iBXrt3W5Akd1Fq5k)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 39db4e3 commit 671c3a9
3 files changed
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1443 | 1443 | | |
1444 | 1444 | | |
1445 | 1445 | | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
1446 | 1471 | | |
1447 | 1472 | | |
1448 | 1473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
0 commit comments