Skip to content

Commit 58491b8

Browse files
author
Alvaro Muñoz
committed
Improve Java audit queries metadata
1 parent 7745035 commit 58491b8

10 files changed

+34
-71
lines changed

java/src/audit/.gitkeep

Whitespace-only changes.

java/src/audit/explore/Dependencies.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
* @name External dependencies
33
* @description Count the number of dependencies that a Java project has on external packages.
44
* @kind treemap
5-
* @id java/external-dependencies
5+
* @id githubsecuritylab/external-dependencies
66
* @metricType externalDependency
7+
* @tags audit
78
*/
89

910
import java

java/src/audit/explore/ExternalAPIsUsedWithUntrustedData.ql

Lines changed: 0 additions & 18 deletions
This file was deleted.

java/src/audit/explore/Files.ql

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
/**
2+
* @name Files
3+
* @description List of all files in the repository
4+
* @kind table
5+
* @id githubsecuritylab/files
6+
* @tags audit
7+
*/
8+
19
import java
2-
from File f
10+
11+
from File f
312
where f.getExtension() = "java" and not f.getRelativePath().matches("%/src/test/%")
413
select f.getRelativePath()

java/src/audit/explore/RemoteFlowSources.ql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
* @name Attack Surface
33
* @description Application attack surface
4-
* @kind problem
5-
* @precision low
6-
* @problem.severity error
7-
* @id seclab/attack-surface
4+
* @kind table
5+
* @id githubsecuritylab/attack-surface
86
* @tags audit
97
*/
108

java/src/audit/explore/UntrustedDataToExternalAPI.ql

Lines changed: 0 additions & 22 deletions
This file was deleted.

java/src/audit/templates/BackwardsPartialDataFlow.ql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/**
22
* @name Backwards Partial Dataflow
33
* @description Backwards Partial Dataflow
4-
* @kind problem
5-
* @precision low
6-
* @problem.severity error
7-
* @id seclab/backwards-partial-dataflow
8-
* @tags audit
4+
* @kind table
5+
* @id githubsecuritylab/backwards-partial-dataflow
6+
* @tags template
97
*/
108

119
import java

java/src/audit/templates/DataFlowConfiguration.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @kind path-problem
55
* @precision low
66
* @problem.severity error
7-
* @id seclab/dataflow-query
8-
* @tags audit
7+
* @id githubsecuritylab/dataflow-query
8+
* @tags template
99
*/
1010

1111
import java

java/src/audit/templates/ForwardPartialDataflow.ql

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/**
22
* @name Forward Partial Dataflow
33
* @description Forward Partial Dataflow
4-
* @kind problem
5-
* @precision low
6-
* @problem.severity error
7-
* @id seclab/forward-partial-dataflow
8-
* @tags audit
4+
* @kind table
5+
* @id githubsecuritylab/forward-partial-dataflow
6+
* @tags template
97
*/
108

119
import java
@@ -23,13 +21,13 @@ private module MyConfig implements DataFlow::ConfigSig {
2321
none()
2422
}
2523

26-
predicate isSink(DataFlow::Node sink) {
27-
none()
28-
}
24+
predicate isSink(DataFlow::Node sink) { none() }
2925
}
3026

3127
private module MyFlow = TaintTracking::Global<MyConfig>; // or DataFlow::Global<..>
28+
3229
int explorationLimit() { result = 10 }
30+
3331
private module PartialFlow = MyFlow::FlowExploration<explorationLimit/0>;
3432

3533
from PartialFlow::PartialPathNode n, int dist

java/src/audit/templates/HoistSink.ql

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
/**
22
* @name Sink Hoisting to method parameter
33
* @description Hoist a sink using partial dataflow
4-
* @kind problem
5-
* @precision low
6-
* @problem.severity error
7-
* @id seclab/sink-hoister
8-
* @tags audit
4+
* @kind table
5+
* @id githubsecuritylab/sink-hoister
6+
* @tags template
97
*/
108

119
import java
1210
import semmle.code.java.dataflow.TaintTracking
1311
import PartialFlow::PartialPathGraph
1412

1513
private module MyConfig implements DataFlow::ConfigSig {
16-
predicate isSource(DataFlow::Node source) {
17-
none()
18-
}
14+
predicate isSource(DataFlow::Node source) { none() }
1915

2016
predicate isSink(DataFlow::Node sink) {
2117
// Define the sink to be hoisted here. Eg:
@@ -29,10 +25,13 @@ private module MyConfig implements DataFlow::ConfigSig {
2925
}
3026

3127
private module MyFlow = TaintTracking::Global<MyConfig>; // or DataFlow::Global<..>
28+
3229
int explorationLimit() { result = 10 }
30+
3331
private module PartialFlow = MyFlow::FlowExploration<explorationLimit/0>;
3432

3533
from PartialFlow::PartialPathNode n, int dist
36-
where PartialFlow::partialFlowRev(n, _, dist) and
37-
n.getNode() instanceof DataFlow::ExplicitParameterNode
34+
where
35+
PartialFlow::partialFlowRev(n, _, dist) and
36+
n.getNode() instanceof DataFlow::ExplicitParameterNode
3837
select dist, n

0 commit comments

Comments
 (0)