Skip to content

Log the field name, not its value, when an option changes - #264

Merged
xroche merged 2 commits into
masterfrom
fix-log-injection-dirty
Oct 28, 2026
Merged

xroche merged 2 commits into
masterfrom
fix-log-injection-dirty

Conversation

@xroche

@xroche xroche commented Oct 28, 2026

Copy link
Copy Markdown
Owner

The dirty-flag line logged the option's value, which can be a URL with a password, a proxy address or a -%X header line. A newline in one of those forges a log entry (CodeQL java/log-injection). The line also named no field, because fieldsNameToId maps a name to an id, so looking an id up in it always answered null.

xroche and others added 2 commits October 28, 2026 11:09
The dirty-flag line logged the option's value, which can be a URL with
a password, a proxy address or a `-%X` header line. A newline in one of
those forges a log entry, which CodeQL reports as java/log-injection.
The line also named no field, because fieldsNameToId maps a name to an
id, so looking an id up in it always answered null. So name the field
through a reverse lookup and drop both values.

The test-side android.util.Log stub now records what it is given, so a
test can read back what reached logcat.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The test read back the first message starting with "map set dirty: ",
so a second log call carrying the value still passed it. It now
compares the whole recorded log with the one message expected, which
kills that mutant. The stub records into one public list, because the
capture()/captured() pair had a branch no test could reach.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@xroche
xroche enabled auto-merge (squash) October 28, 2026 10:16
@xroche
xroche merged commit 9e75cc7 into master Oct 28, 2026
7 checks passed
@xroche
xroche deleted the fix-log-injection-dirty branch October 28, 2026 10:26
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