Skip to content

fix(httputil): CR/LF log sanitizer barrier (CodeQL #5/#6) + .trivyignore refresh - #162

Merged
maxfield-allison merged 2 commits into
mainfrom
fix/codeql-log-injection-crlf-barrier
Aug 7, 2026
Merged

fix(httputil): CR/LF log sanitizer barrier (CodeQL #5/#6) + .trivyignore refresh#162
maxfield-allison merged 2 commits into
mainfrom
fix/codeql-log-injection-crlf-barrier

Conversation

@maxfield-allison

@maxfield-allison maxfield-allison commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

Security housekeeping, two related changes.

1. CodeQL log-injection (CWE-117) — alerts #5/#6

Closes the two open code-scanning alerts on the debug logs in userAgentTransport.RoundTrip (pkg/httputil/client.go).

The logged URL already passed through sanitizeURL() -> stripControlChars(), which removed all control characters including CR/LF. But the stripping used strings.Map, which CodeQL's taint tracking doesn't recognize as a newline barrier — so the sanitizer was invisible to the analyzer and the alert persisted.

  • stripControlChars now removes CR and LF explicitly via strings.ReplaceAll first (the canonical CWE-117 barrier that static analyzers recognize), then keeps the strings.Map pass for any other control characters.
  • No behavior change for callers — output is identical, just expressed legibly for CodeQL.
  • Strengthened TestSanitizeURL_StripsControlChars to explicitly assert CR/LF are absent.

2. .trivyignore refresh

  • Bumped the lapsed review date (2026-07-01 -> 2026-11-01; moby/moby/v2 is still pre-release, so the acceptance stands).
  • Documented two additional daemon-side docker/docker CVEs that a local trivy image scan surfaces (CVE-2026-41567 malicious-image RCE, CVE-2026-42306 host-file-overwrite race). Both are Docker Engine/Moby daemon vulns with no fix in the v28.x module; dnsweaver uses the SDK as a read-only client and runs no daemon, so the paths are unreachable (govulncheck agrees). The GitLab trivy gate already passes them via --ignore-unfixed; listing them makes the acceptance explicit.

Context

Part of a security sweep: govulncheck (source) and trivy (image) were both run. Findings are limited to the known, unreachable, no-upstream-fix docker/docker daemon CVEs already accepted by CI policy. The Alpine 3.23.5 base image scans clean (0 vulns).

Validation

go build, go vet, go test ./pkg/httputil/ pass; local trivy gate (trivy fs --severity CRITICAL,HIGH --ignore-unfixed --ignorefile .trivyignore) exits 0.

CodeQL kept flagging the two HTTP request/response debug logs in
userAgentTransport.RoundTrip (CWE-117 log injection, alerts #5/#6) even though
the URL already passed through sanitizeURL -> stripControlChars. The stripping
used strings.Map, which the taint analyzer does not recognize as a newline
barrier, so the sanitizer was invisible to it.

Neutralize CR and LF explicitly with strings.ReplaceAll first (the canonical,
analyzer-recognized CWE-117 barrier), then keep the strings.Map pass to drop any
other control characters. Behavior is unchanged for callers; this makes the
existing guarantee legible to CodeQL and closes the alerts.

Strengthen TestSanitizeURL_StripsControlChars to assert CR/LF are absent.
Bump the lapsed review date (2026-07-01 -> 2026-11-01; moby/moby/v2 is still
pre-release, so the acceptance stands) and document two additional daemon-side
docker/docker CVEs that a local trivy image scan surfaces:

- CVE-2026-41567: malicious-image arbitrary code execution
- CVE-2026-42306: host file overwrite via container-archive race

Both are Docker Engine/Moby daemon vulnerabilities with no fix in the v28.x
github.com/docker/docker module. dnsweaver uses the SDK as a read-only client
and runs no daemon, so the paths are unreachable (govulncheck reachability
analysis agrees). The GitLab trivy gate already passes them via --ignore-unfixed;
listing them here makes the acceptance explicit and self-documenting.
@maxfield-allison maxfield-allison changed the title fix(httputil): use explicit CR/LF barrier in log sanitizer (CodeQL #5/#6) fix(httputil): CR/LF log sanitizer barrier (CodeQL #5/#6) + .trivyignore refresh Aug 7, 2026
@maxfield-allison
maxfield-allison merged commit 701ae19 into main Aug 7, 2026
6 checks passed
@maxfield-allison
maxfield-allison deleted the fix/codeql-log-injection-crlf-barrier branch August 7, 2026 13:38
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