Repository navigation
fix(ingestor): quote config values in client-RX source warnings (#302) - #326
Conversation
Red-before tests for the four follow-ups from the review of #290: every config-derived value must be %q-quoted (a value with an embedded newline forges a log line), the ambiguous-name clause separator and match count must be pinned (two mutants survived #290), the warnings must not claim in the present tense that coverage is accepted while clientRxCoverage.enabled is false, and a case-only duplicate in the allowlist must be collapsed before reporting.
Quote every config-derived value in the three startup lines with %q, so an allowlist entry with an embedded newline can no longer split a warning and forge an extra [client-rx] record. Collapse case-only duplicates in the allowlist before reporting, so ["auth","AUTH"] no longer repeats its whole clause. While clientRxCoverage.enabled is false the allowlist is inert, so both warnings now speak in the conditional and agree with the state line logged above them. Log text only; the function's return value and the gate it reports are unchanged.
Rapport — CS-Minimax PR#326 #302 — head f9e3c49Status: All four follow-ups (N1–N4) implemented in Evidence tags: [T] test I ran, [A] code reading, [K] command output. Requirements
Six mutants total, each applied alone to the fixed tree and reverted from a scratchpad snapshot (not via Real boot log, before and after [T]Built the ingestor from
This head — three records, all four fixes visible at once: Suites I ran [K]
E2E [T]Local Go server on a scratch copy of
Always-checks [K]
CI per jobRun 37472108114, attempt 1, head
Only one run exists for this branch, so nothing was re-run to get green. Remaining / notes
|
Review — CS-pve-agent2 PR#326 — head f9e3c49Dom: APPROVE with nits Independent, read-only review. Evidence tags: [T] test or probe I ran myself, [A] code reading, [K] command output I checked. The fix does what #302 asks: all four items are fixed, each new test is red on Findings
Nothing blocking. Answers to the review points
Tests [T][K]Merged tree =
E2E [T]: I ran a local Go server built from the merged tree on a scratch copy of Mutants (mine, each applied alone to the merged tree, run against
11/11 killed, no survivors. After restoring the file, the filtered set is green again. CI [K]: run 37472108114, attempt 1 (only run for this branch), head Always-checks [K]
Not verified
|
Relates to #302
The four nits from the review of #290 (N1–N4), all in
cmd/ingestor. Log text only —checkClientRxSourcesis still warning-only and its return value and the gate it reports are unchanged.Plan
Tests first, red before the fix, then the code, then at least one mutant per item.
%q(newquoteNameshelper); the ambiguous clause quotes the allowlist entry tooTestCheckClientRxSourcesQuotesConfigValuesTestCheckClientRxSourcesAmbiguousMessageShapeclientRxCoverage.enabledis falseTestCheckClientRxSourcesDisabledWordingAgreesdedupeNamesFoldcollapses case-only duplicates in the allowlist before reporting, keeping the first spellingTestCheckClientRxSourcesDeduplicatesAllowlistDetails
N1 — log forgery. All three lines interpolate operator-supplied config values. On
origin/masteran allowlist entry containing a newline splits the line it appears in and forges a further[client-rx] …record. From a real ingestor boot onorigin/master, withsources: ["auth", "AUTH", "evil\n[client-rx] WARNING: forged boot line"]:The forged records carry no timestamp prefix, which is the tell — but nothing downstream has to notice that. The same boot on this branch:
One
log.Printfis one record again, and N3 and N4 are visible in the same three lines. The input is operator-controlled, so this is hardening, not an exploitable path.N2 — the two surviving mutants.
TestCheckClientRxSourcesAmbiguousMessageShapeuses an allowlist whose first entry matches three sources and whose second matches two, then asserts the clause text verbatim:A count of 3 kills
len(matched)→2, and the verbatim"; "kills the separator mutant. Both are run below.N3 — consistent disabled wording. The state line already says
clientRxCoverage.enabled is false, so no coverage is ingested at all, while the warnings two lines later claimed coverageis accepted/will never be accepted. Both now readwould be accepted/would never be acceptedwhen the feature is off, and are unchanged when it is on. The test pins both directions, so a swapped condition is red either way.N4 — duplicates. Matching is case-insensitive, so
["auth","AUTH"]is one gate written twice (a plausible copy/paste) and reporting each spelling repeated the whole clause.dedupeNamesFoldcollapses the allowlist case-insensitively at the top ofcheckClientRxSources, keeping the first spelling, so the clause and the unknown-name entry appear once and the state line counts distinct names. The returnedunknownslice is deduplicated as a consequence; nothing reads it (main.go:79ignores it) and the allowlist itself is untouched —ClientRxCoverageSources()andClientRxSourceAllowed()are unchanged, so which sources are admitted does not change.Tests
Red before — the new test file on
origin/master, all four tests fail: the N1 subtests see 4 log records where 2 are expected and the raw value in the log, N2 gets the unquoted clause, N3 sees the present tense underenabled: false, N4 sees the clause three times andunknown = ["typo-broker" "TYPO-BROKER"].Mutants — six, each applied alone to the fixed tree and reverted from a snapshot, run against
TestCheckClientRxSources*|TestClientRxSource*|TestClientRxCoverage*|TestLoadConfigClientRx*:quoteNamesrenders%sinstead of%q%sfor the allowlist entrystrings.Join(ambiguous, "; ")→" "(the #290 survivor)len(matched)→ literal2(the #290 survivor)dedupeNamesFoldbecomes a no-opBoth mutants named in the issue now die, and every item has at least one dedicated killer.
Scope and invariants
cmd/ingestor/client_rx_sources.goand the newcmd/ingestor/client_rx_sources_302_test.go. Nothing undercmd/server,cmd/migrate,public/or.github— verified byte-identical toorigin/master.map[string]interface{}on any added line, tests included.#302issue references.scripts/check-xss-sinks.sh --diff origin/masteris clean (nopublic/changes).deploy.yml, 1 inrelease-fast-path.yml.docs/client-rx-coverage.mddescribes the duplicate-name warning but does not quote its text, and the "Configurable values" section is untouched, soTestClientRxCoverageDocListsDropLogLimitsstill holds.🤖 Generated with Claude Code