Commit 99887f5
fix(store): give the off-box audit tee a sink when the process configured none (BACKLOG #1199) (#820)
The tee ends in a logger call, and only two call sites in the package install a
root handler: the serve and supervise subcommands. Every other subcommand runs
with an empty root handler list, and logging.lastResort is WARNING-only, so the
tee's INFO record was dropped outright rather than degraded.
Measured on the real backup subcommand in a child process: it returned 0 with
the archive on disk and an EMPTY stderr, while on the failure arm its ALERT
backup_failed WARNING reached stderr from that same handler-less process and the
audit record did not. That WARNING is the discriminating control -- the stream
worked and the record was dropped by level. So on a first deployment the
dr_backup success and failure rows would produce an off-box copy that is
silently discarded in every configuration.
logging_setup.ensure_logger_sink takes its own handler off the logger, asks
logging.Logger.hasHandlers whether anything else would receive the record, and
on false installs a named stderr handler built by the new shared
build_stderr_handler. The redaction chain is therefore identical to the
configured path's by construction, verified byte-for-byte against what
configure_logging's stdout handler emits for a PHI-bearing detail. The handler
comes back off the moment the process configures a sink, so serve and supervise
are untouched and nothing double-emits. Stderr rather than stdout, because
subcommands print a machine-readable payload to stdout under --json.
The mechanism sits in logging_setup beside the two shipped answers to "how does
this process get a sink", so the four remaining off-box tees #1199 lists cost
one line each. The three store backends' record_audit are untouched: the defect
is the tee's, and fixing it there covers all three call sites at once.
This stops evidence being dropped inside the box. It transmits nothing off the
host, and the ASVS 16.4.3 cell does not reach pass -- the durable forwarder, the
verb-shaped start gate and the rest of that programme stay open on #1199.
Eight guards in tests/test_audit_offbox_tee.py. Six were confirmed red before
the fix; the other two pass in both states by design -- one pins the
handler-less shape the rest are built on, the other is the no-regression guard
that a configured process still gets exactly one copy.
Co-authored-by: wshallwshall <mefordev@messagefoundry.org>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 3c96029 commit 99887f5
4 files changed
Lines changed: 430 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11308 | 11308 | | |
11309 | 11309 | | |
11310 | 11310 | | |
| 11311 | + | |
11311 | 11312 | | |
11312 | 11313 | | |
11313 | 11314 | | |
| |||
11338 | 11339 | | |
11339 | 11340 | | |
11340 | 11341 | | |
| 11342 | + | |
| 11343 | + | |
| 11344 | + | |
| 11345 | + | |
| 11346 | + | |
| 11347 | + | |
| 11348 | + | |
| 11349 | + | |
| 11350 | + | |
| 11351 | + | |
| 11352 | + | |
| 11353 | + | |
| 11354 | + | |
| 11355 | + | |
| 11356 | + | |
| 11357 | + | |
| 11358 | + | |
| 11359 | + | |
| 11360 | + | |
| 11361 | + | |
| 11362 | + | |
| 11363 | + | |
| 11364 | + | |
| 11365 | + | |
| 11366 | + | |
| 11367 | + | |
| 11368 | + | |
| 11369 | + | |
| 11370 | + | |
| 11371 | + | |
| 11372 | + | |
| 11373 | + | |
| 11374 | + | |
| 11375 | + | |
| 11376 | + | |
| 11377 | + | |
| 11378 | + | |
| 11379 | + | |
| 11380 | + | |
| 11381 | + | |
| 11382 | + | |
| 11383 | + | |
| 11384 | + | |
| 11385 | + | |
| 11386 | + | |
| 11387 | + | |
| 11388 | + | |
| 11389 | + | |
| 11390 | + | |
| 11391 | + | |
| 11392 | + | |
| 11393 | + | |
| 11394 | + | |
| 11395 | + | |
| 11396 | + | |
| 11397 | + | |
| 11398 | + | |
| 11399 | + | |
| 11400 | + | |
| 11401 | + | |
| 11402 | + | |
11341 | 11403 | | |
11342 | 11404 | | |
11343 | 11405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
509 | 511 | | |
510 | 512 | | |
511 | 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 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
512 | 607 | | |
513 | 608 | | |
514 | 609 | | |
515 | 610 | | |
516 | 611 | | |
517 | 612 | | |
518 | 613 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
529 | 618 | | |
530 | 619 | | |
531 | 620 | | |
532 | 621 | | |
533 | | - | |
534 | | - | |
535 | | - | |
| 622 | + | |
536 | 623 | | |
537 | 624 | | |
538 | 625 | | |
| |||
0 commit comments