Skip to content

fix: harmonize support-bundle redaction - #9

Merged
Monsterray merged 6 commits into
developfrom
fix/redaction-harmonization
Aug 22, 2026
Merged

Monsterray merged 6 commits into
developfrom
fix/redaction-harmonization

Conversation

@Monsterray

Copy link
Copy Markdown
Owner

Summary\n- use the shared redaction vocabulary for support bundles\n- redact quoted JSON/YAML credential assignments\n- keep the scanner fail-closed without matching its own manifest metadata\n\n## Validation\n- PASS: 31 source-level tests (1 optional Docker smoke skipped)\n- PASS: compileall and diff check\n\nHardware is NOT APPLICABLE to this offline packaging support tool.

Monty Perrotti and others added 6 commits August 15, 2026 11:44
A support bundle exists to be handed to a stranger, so anything the redactor
misses is a credential disclosure. Three defects let eight classes through.

The keyword was anchored with \b, but _ is a word character, so \bpassword
could never match inside DB_PASSWORD. Every PREFIX_SECRET= style variable
passed through untouched. The file already carried hardcoded mqtt_password and
tls_key_password alternatives as one-off workarounds for this exact bug; the
boundary is now generalised and those special cases are gone.

The value group stopped at the first space, so for "Authorization: Bearer
<token>" it captured the scheme word and left the credential in plaintext one
space later -- while the manifest recorded a redaction as applied, which reads
as false assurance.

URL_USERINFO required a :password segment, so mqtt://alice@host leaked the
username. There was also no IPv6 pattern at all, so IPv6 literals were neither
pseudonymised nor caught by the final scan; mochad-redux already had one.

Adds api[_-]?key to the keyword set for the dashed X-API-Key header form.

Verified with redaction-conformance.py, which runs one corpus through all
three sibling collectors: this one now redacts all 13 secret patterns and
leaves all 7 ordinary log lines untouched. Full suite unchanged at the Windows
baseline of 23 passed, 7 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The rules that both redact and fail the build were flagging text they had
just sanitised, so the post-redaction scan refused to package any bundle
containing an Authorization header or a broker URL. The tool failed closed on
exactly the systems that need it -- an end-to-end run produced no archive at
all rather than a clean one.

Two causes. The "not already redacted" guard sat after \s*, so the engine
backtracked one space, evaluated it against " [REDACTED:...", found it passed
and matched anyway; the guard now sits immediately after the single-character
[=:] and spans the whitespace itself, a position backtracking cannot move.
The URL rules had no guard at all, so [REDACTED:...] satisfied the userinfo
character class.

Verified by building real bundles with planted secrets and scanning every
decompressed archive member: bundles now build, and redaction is idempotent
and scan-clean. Both properties are now enforced by
redaction-conformance.py's round-trip section.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The three sibling collectors named the same redaction classes differently, so
a support engineer reading three bundles had to learn three vocabularies:
keyword secrets were [REDACTED:secret] in two repos but [REDACTED:credential]
here, and URL credentials were [REDACTED:url_userinfo] in two but
[REDACTED:credentials] in the bridge.

Adopts the majority name in each case. No behaviour changes -- the same text
is redacted, only the placeholder label differs. Updates the one test that
asserted on the old label.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
These repositories are developed across Windows, macOS and Linux, but the
daemon, container entrypoints, udev rules, systemd units and shell scripts are
all consumed by Linux at runtime. Until now nothing in the repository enforced
that -- correctness depended on each contributor's local core.autocrlf, which
is invisible, per-machine, and easy to get wrong.

Two concrete failures this prevents, both of which happened here: a CRLF
container entrypoint fails at startup with a confusing "exec format error", and
CRLF shell scripts made ShellCheck report 2255 spurious SC1017 "literal
carriage return" findings against 23 real ones.

"* text=auto eol=lf" also covers the extensionless executables --
scripts/backup/mochad-redux-backup, packaging/openwrt/* -- that an
extension-keyed rule would miss. PNGs are marked binary so they are never
newline-converted or line-diffed.

Verified with git add --renormalize: no tracked file's stored content changes,
so this is forward protection rather than a rewrite. Confirmed live by staging
a CRLF file and observing Git store it as LF.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Monsterray
Monsterray merged commit 24d7a3d into develop Aug 22, 2026
1 check passed
@Monsterray
Monsterray deleted the fix/redaction-harmonization branch August 22, 2026 18:30
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