File tree Expand file tree Collapse file tree
java/ql/src/Security/CWE/CWE-918 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ import semmle.code.java.dataflow.DataFlow
88import semmle.code.java.dataflow.TaintTracking
99private import semmle.code.java.StringFormat
1010
11+ /**
12+ * Holds if taint is propagated from `pred` to `succ`.
13+ */
1114predicate 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+ */
244255class HostnameSanitizedExpr extends Expr {
245256 HostnameSanitizedExpr ( ) {
246257 // Sanitize expressions that come after a sanitizing prefix in a tree of string additions:
You can’t perform that action at this time.
0 commit comments