Skip to content

Commit de2d722

Browse files
committed
refactor(java): update comments and improve source filtering in PartialPaths queries
1 parent 14a4f62 commit de2d722

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

java/src/debugging/PartialPathsFromSink.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ private import RemoteFlowsPartial::PartialPathGraph
3232

3333
from RemoteFlowsPartial::PartialPathNode source, RemoteFlowsPartial::PartialPathNode sink
3434
where
35-
// Only show sinks from a certain file
36-
findByLocation(sink.getNode(), "File.java", _) and
37-
// Only show sources that match our criteria
35+
/// Only show sinks from a certain file
36+
// findByLocation(sink.getNode(), "File.java", _) and
37+
/// Only show sources that match our criteria
3838
// checkSource(source.getNode()) and
39-
// Partical Path
39+
/// Partical Path
4040
RemoteFlowsPartial::partialFlow(source, sink, _)
4141
select sink.getNode(), source, sink, "Partial Graph $@.", source.getNode(), "user-provided value"

java/src/debugging/PartialPathsFromSource.ql

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,9 @@ import semmle.code.java.dataflow.DataFlow
1515
import semmle.code.java.dataflow.FlowSources
1616
import semmle.code.java.dataflow.TaintTracking
1717

18-
class Sources extends AllSources {
19-
Sources() {
20-
findByLocation(this, "App.java", _)
21-
}
22-
23-
}
24-
2518
// Partial Graph
2619
private module RemoteFlowsConfig implements DataFlow::ConfigSig {
27-
predicate isSource(DataFlow::Node source) { source instanceof Sources }
20+
predicate isSource(DataFlow::Node source) { source instanceof AllSources }
2821

2922
predicate isSink(DataFlow::Node sink) { none() }
3023
}
@@ -39,10 +32,10 @@ private import RemoteFlowsPartial::PartialPathGraph
3932

4033
from RemoteFlowsPartial::PartialPathNode source, RemoteFlowsPartial::PartialPathNode sink
4134
where
42-
// Filter by file (line number)
35+
/// Filter by file (line number)
4336
// findByLocation(source.getNode(), "File.java", _) and
44-
// Filter by if the sink is callable
37+
/// Filter by if the sink is callable
4538
// isCallable(sink.getNode()) and
46-
// Perform Partial Flow query
39+
/// Perform Partial Flow query
4740
RemoteFlowsPartial::partialFlow(source, sink, _)
4841
select sink.getNode(), source, sink, "Partial Graph $@.", source.getNode(), "user-provided value"

0 commit comments

Comments
 (0)