Skip to content

Commit 960a903

Browse files
committed
Java SSRF query: document RequestForgeryAdditionalTaintStep and use Unit not string for a supertype.
1 parent 575198a commit 960a903

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

java/ql/src/semmle/code/java/security/RequestForgery.qll

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** Provides classes to reason about Server-side Request Forgery attacks. */
2+
13
import java
24
import semmle.code.java.frameworks.Networking
35
import semmle.code.java.frameworks.ApacheHttp
@@ -8,16 +10,21 @@ import semmle.code.java.dataflow.DataFlow
810
import semmle.code.java.dataflow.TaintTracking
911
private import semmle.code.java.StringFormat
1012

11-
abstract class RequestForgeryAdditionalTaintStep extends string {
12-
bindingset[this]
13-
RequestForgeryAdditionalTaintStep() { any() }
14-
13+
/**
14+
* A unit class for adding additional taint steps that are specific to Server-side
15+
* Request Forgery (SSRF) attacks.
16+
*
17+
* Extend this class to add additional taint steps to the SSRF query.
18+
*/
19+
class RequestForgeryAdditionalTaintStep extends Unit {
20+
/**
21+
* Holds if the step from `pred` to `succ` should be considered a taint
22+
* step for Server-side Request Forgery.
23+
*/
1524
abstract predicate propagatesTaint(DataFlow::Node pred, DataFlow::Node succ);
1625
}
1726

1827
private class DefaultRequestForgeryAdditionalTaintStep extends RequestForgeryAdditionalTaintStep {
19-
DefaultRequestForgeryAdditionalTaintStep() { this = "DefaultRequestForgeryAdditionalTaintStep" }
20-
2128
override predicate propagatesTaint(DataFlow::Node pred, DataFlow::Node succ) {
2229
// propagate to a URI when its host is assigned to
2330
exists(UriCreation c | c.getHostArg() = pred.asExpr() | succ.asExpr() = c)

0 commit comments

Comments
 (0)