Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6249ee

Browse files
committed
Add doc comments
1 parent 26e10f3 commit e6249ee

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

java/ql/src/Security/CWE/CWE-918/RequestForgery.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import semmle.code.java.dataflow.DataFlow
88
import semmle.code.java.dataflow.TaintTracking
99
private import semmle.code.java.StringFormat
1010

11+
/**
12+
* Holds if taint is propagated from `pred` to `succ`.
13+
*/
1114
predicate requestForgeryStep(DataFlow::Node pred, DataFlow::Node succ) {
1215
// propagate to a URI when its host is assigned to
1316
exists(UriCreation c | c.getHostArg() = pred.asExpr() | succ.asExpr() = c)
@@ -205,6 +208,9 @@ private class HostnameSanitzingPrefix extends CompileTimeConstantExpr {
205208
)
206209
}
207210

211+
/**
212+
* Gets the offset in this constant string where a sanitizing substring begins.
213+
*/
208214
int getOffset() { result = offset }
209215
}
210216

@@ -241,6 +247,11 @@ private MethodAccess getAChainedAppend(Expr e) {
241247
result.getCallee().getName() = "append"
242248
}
243249

250+
/**
251+
* An expression that is sanitized because it is concatenated onto a string that looks like
252+
* a hostname or a URL separator, preventing the appended string from arbitrarily controlling
253+
* the addressed server.
254+
*/
244255
class HostnameSanitizedExpr extends Expr {
245256
HostnameSanitizedExpr() {
246257
// Sanitize expressions that come after a sanitizing prefix in a tree of string additions:

0 commit comments

Comments
 (0)