Skip to content

Conversation

@owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Dec 16, 2025

This PR adds classes so users can add query-specific sanitizers using data extensions ("models-as-data", or MaD), using the query id as the kind string to determine which queries it applies to. Note that in the PR where existing sanitizers were converted to MaD the extension points were all using existing sink kinds as the kind string. I think it's fine for both to exist.

To do: add more classes so that sanitizers can be added for more existing sink kinds and apply wherever the corresponding sinks would apply.

Note that the first commit was done using copilot (prompt in commit message).

This was implemented by Gemini 3 using the following prompt.

In the commit with the hash 10c5a47 the go language library was updated. I want you to do the same for the java language library. Here are the steps to follow:
- Find all .ql files in the java folder which are not in java/ql/src/experimental which contain the string "@kind path-problem".
- Note the query id, as specified by the "@id" metadata at the top of the .ql file. It should have this format: "java/sql-injection".
- These are path queries, so the second and third arguments in the select statement should have type "XFlow::PathNode"s for some module "XFlow" that is defined as something like "TaintTracking::Global<XFlowConfig>". Find the definition of the data flow config ("XFlowConfig" in my example code), which should be a module which implements `DataFlow::ConfigSig`.
- If the module does not already define it, add a predicate like the following:
`predicate isBarrier(DataFlow::Node node) { barrierNode(node, "Z") }` where "Z" should be the query id from earlier.
- If the module already defines that predicate, add `or barrierNode(node, "Z")` to the end of the predicate body, where "Z" should be the query id.
@github-actions github-actions bot added the Java label Dec 16, 2025
import semmle.code.java.dataflow.TaintTracking
import semmle.code.java.frameworks.android.Intent
import semmle.code.java.security.SensitiveActions
private import semmle.code.java.dataflow.ExternalFlow

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
semmle.code.java.dataflow.FlowSinks
.
/** Provides a taint-tracking configuration to reason about externally controlled format string vulnerabilities. */

import java
private import semmle.code.java.dataflow.ExternalFlow

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
semmle.code.java.dataflow.FlowSinks
.
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.dataflow.TaintTracking
import semmle.code.java.security.GroovyInjection
private import semmle.code.java.dataflow.ExternalFlow

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
semmle.code.java.security.GroovyInjection
.
import semmle.code.java.dataflow.TaintTracking
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.security.SensitiveActions
private import semmle.code.java.dataflow.ExternalFlow

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
semmle.code.java.dataflow.FlowSinks
.
import semmle.code.java.dataflow.DataFlow
import semmle.code.java.controlflow.Guards
import semmle.code.java.security.SecurityTests
private import semmle.code.java.dataflow.ExternalFlow

Check warning

Code scanning / CodeQL

Redundant import Warning

Redundant import, the module is already imported inside
semmle.code.java.dataflow.FlowSinks
.
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.

1 participant