Skip to content

Java: Exclude internal logging from stack trace exposure#20

Open
mrigankpawagi wants to merge 1 commit into
mainfrom
improve-java-stack-trace-internal-logging
Open

Java: Exclude internal logging from stack trace exposure#20
mrigankpawagi wants to merge 1 commit into
mainfrom
improve-java-stack-trace-internal-logging

Conversation

@mrigankpawagi

Copy link
Copy Markdown
Owner

Fix

Adds a barrier in the java/stack-trace-exposure query for stack trace strings that flow into logging framework calls (SLF4J, Log4j, java.util.logging), preventing them from being flagged as exposed to users.

Problem

The query flags stack traces that are logged internally (e.g., logger.error("Failed", e)) as information exposure. Internal logging to files or aggregation systems is not exposure to end users. This generates many false positives in applications that properly log exceptions for debugging while returning generic error messages to users.

Validation

Static analysis confirms that logging framework calls write to internal log files/streams, not HTTP responses. The barrier is added at the configuration level so it only stops flow that would otherwise reach an HTTP response sink via a logging call.

When a stringified stack trace flows into a logging framework method
(SLF4J, Log4j, java.util.logging), it should not be considered as
exposed to external users. This adds a barrier to prevent false
positives where stack traces are properly logged internally.
@github-actions github-actions Bot added the Java label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants