Java: Exclude DEBUG/TRACE level logging from java/log-injection sinks#7
Closed
mrigankpawagi wants to merge 1 commit into
Closed
Java: Exclude DEBUG/TRACE level logging from java/log-injection sinks#7mrigankpawagi wants to merge 1 commit into
mrigankpawagi wants to merge 1 commit into
Conversation
Owner
Author
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.
Summary
This PR improves the
java/log-injectionquery by excluding DEBUG and TRACE level logging calls from log injection sinks.Problem
MRVA (Multi-Repository Variant Analysis) on top-100 Java repositories revealed 5769 log injection alerts, of which 2401 (41%) were at TRACE/DEBUG/FINE level. These are false positives because:
Changes
Modified the
DefaultLogInjectionSinkclass inLogInjection.qllto exclude method calls to:debug,trace(SLF4J, Log4j, Commons Logging, JBoss Logging)fine,finer,finest(java.util.logging)MRVA Validation
Why this is correct
Log injection (CWE-117) is about injecting forged entries into production log files. The attack vector requires that the injected content actually appears in monitored log output. Debug/trace level logging is:
This matches the approach taken by the Python py/log-injection query which similarly excludes development-only logging patterns.