Skip to content

harden(filters): match_output unless guards + strip-pattern narrowing (#100 G8) - #103

Merged
thehoff merged 1 commit into
developfrom
harden/g8-audit-100
May 20, 2026
Merged

thehoff merged 1 commit into
developfrom
harden/g8-audit-100

Conversation

@thehoff

@thehoff thehoff commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the G8 (TOML filter configs + test harness) findings from audit #100. Codex-reviewed — clean, no findings.

Findings fixed

  • 8 match_output filters (brew-install, bundle-install, composer-install, dotnet-build, poetry-install, quarto-render, tofu-validate, uv-sync) — added a case-insensitive unless guard so a failure-containing run is not short-circuited to the success message. Each tailored to the tool's failure vocabulary; each got a new inline [[tests.*]] failure case. (brew-install deliberately excludes the word warning — brew prints a benign Warning: <pkg> is already installed on the success path; Error: still blocks.)
  • oxlint.toml / helm.toml — narrowed strip_lines_matching so real warning-summary lines survive (only the all-clear noise is stripped).
  • tests/cloud_hardening.rs — per-invocation temp RTK_DB_PATH, replacing the shared cc-hardening-<pid>.sqlite (removes order-dependence).

Filter engine (toml_filter.rs) untouched — config + test edits only.

Test plan

  • cargo test --workspace — 2293 pass, 0 fail
  • contextcrawler verify — 156/156 inline filter tests pass
  • cargo build --release clean
  • Codex review — guards verified sound, mergeable

Part of the #100 audit.

🤖 Generated with Claude Code

)

Audit group G8 of #100 — TOML filter configs + test harness.

Finding 1: add `unless` guards to 8 match_output filters that could
short-circuit a failing run to a success message. Each guard is
case-insensitive ((?i)) and tailored to the tool's failure vocabulary,
with a new inline test proving a failure-containing input is not
swallowed:
  - brew-install:   (?i)\berror[: ]|\bfailed\b|\bfatal\b|cannot install
                    (warning excluded — benign "Warning: already installed")
  - bundle-install: (?i)\berror\b|\bwarning\b|\bfailed\b|\bfatal\b|could not find|conflict
  - composer-install: (?i)\berror\b|\bwarning\b|\bfailed\b|\bfatal\b|your requirements could not be resolved|deprecated
  - dotnet-build:   (?i)\bwarning [A-Z]+\d|\berror [A-Z]+\d|build failed|\bfatal\b
  - poetry-install: (?i)\berror\b|\bwarning\b|\bfailed\b|\bfatal\b|could not|version solving failed
  - quarto-render:  (?i)\berror\b|\bwarning\b|\bfailed\b|\bfatal\b|caused by:
  - tofu-validate:  (?i)\berror[: ]|\bwarning[: ]|\bfailed\b|\bfatal\b
  - uv-sync:        (?i)\berror[: ]|\bwarning[: ]|\bfailed\b|\bfatal\b|no solution found

Finding 2: narrow over-broad strip patterns so a warnings-only run is
not mistaken for clean.
  - oxlint: strip only the all-clear summary ("Found 0 warnings and 0
    errors"); non-zero warning summary now survives.
  - helm: narrow "^W\d{4}" to the full glog format
    ("^W\d{4} \d{2}:\d{2}:\d{2}") so a real warning line beginning with
    W+digits is not eaten.

Finding 3: cloud_hardening.rs used a shared cc-hardening-<pid>.sqlite DB
across all tests (order-dependence risk). Each run_cc invocation now
gets its own tempfile::TempDir-backed RTK_DB_PATH.

Finding 4 (NICE): gradle/pio-run/tofu-plan/xcodebuild on_empty can fire
on a crash with no stdout. The TOML schema has no exit-code field and
the engine only sees output text, so this cannot be gated without an
engine change (out of scope). Limitation documented inline in each file.

No filter count change (edits to existing files only). Engine
(toml_filter.rs) untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@thehoff
thehoff merged commit 66552dd into develop May 20, 2026
4 checks passed
@thehoff
thehoff deleted the harden/g8-audit-100 branch May 20, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant