Skip to content

Java: java/sensitive-log should follow flow through character-filtering callables - #22850

Open
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:java/char-filtering-callable
Open

owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:java/char-filtering-callable

Conversation

@owen-mc

@owen-mc owen-mc commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@owen-mc owen-mc changed the title Java/char filtering callable Java: java/sensitive-log should follow flow through character-filtering callables Oct 20, 2026
@github-actions github-actions Bot added the Java label Oct 20, 2026
@owen-mc
owen-mc force-pushed the java/char-filtering-callable branch from 5a0f3af to e010681 Compare October 20, 2026 11:55
@owen-mc
owen-mc marked this pull request as ready for review October 21, 2026 13:57
@owen-mc
owen-mc requested a review from a team as a code owner October 21, 2026 13:57
Copilot AI max review requested due to automatic review settings October 21, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved flow-inference errors cause false alerts and missed sensitive logging.

7 open issues
What changed in this PR

Extends java/sensitive-log to follow sensitive data through Java character-filtering helpers.

Changes:

  • Infer flow through character-copying loops and output parameters.
  • Integrate inferred flow into sensitive logging analysis.
  • Add positive and negative regression cases with expected results.
File Description
java/​ql/​test/​query-tests/​security/​CWE-532/​SensitiveLogInfo.expected Updates expected alerts and flow paths.
java/​ql/​test/​query-tests/​security/​CWE-532/​CharacterFilteringTest.java Adds filtering and non-preserving transformation cases.
java/​ql/​lib/​semmle/​code/​java/​security/​SensitiveLoggingQuery.qll Enables character-filtering flow steps.
java/​ql/​lib/​semmle/​code/​java/​dataflow/​CharacterFiltering.qll Implements character-filtering summary inference.

Review effort: Max

Comment thread java/ql/lib/semmle/code/java/dataflow/CharacterFiltering.qll
Comment thread java/ql/lib/semmle/code/java/dataflow/CharacterFiltering.qll
DataFlow::localFlowStep(source, sink)
or
exists(MethodCall conversion |
conversion.getMethod().hasQualifiedName("java.lang", "Character", ["toChars", "toString"]) and
Comment thread java/ql/lib/semmle/code/java/dataflow/CharacterFiltering.qll
Comment thread java/ql/lib/semmle/code/java/dataflow/CharacterFiltering.qll
*/
predicate characterFilteringCallStep(DataFlow::Node input, DataFlow::Node output) {
exists(MethodCall call, int inputPosition, LocalScopeVariable filteredOutput |
characterFilteringOutput(call.getMethod(), inputPosition, filteredOutput) and
Comment thread java/ql/lib/semmle/code/java/dataflow/CharacterFiltering.qll

This branch has not been deployed

No deployments
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