Repository navigation
Log the field name, not its value, when an option changes - #264
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The dirty-flag line logged the option's value, which can be a URL with a password, a proxy address or a
-%Xheader line. A newline in one of those forges a log entry (CodeQL java/log-injection). The line also named no field, becausefieldsNameToIdmaps a name to an id, so looking an id up in it always answered null.