File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed
semmle/code/java/security Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 11
11
*/
12
12
13
13
import java
14
- import ResponseSplitting
14
+ import ServletResponseSplitting
15
15
import DataFlow:: PathGraph
16
16
17
17
class ResponseSplittingConfig extends TaintTracking:: Configuration {
18
18
ResponseSplittingConfig ( ) { this = "ResponseSplittingConfig" }
19
19
20
20
override predicate isSource ( DataFlow:: Node source ) {
21
21
source instanceof RemoteFlowSource and
22
- not source instanceof WhitelistedSource
22
+ not source instanceof TrustedSource
23
23
}
24
24
25
25
override predicate isSink ( DataFlow:: Node sink ) { sink instanceof HeaderSplittingSink }
Original file line number Diff line number Diff line change 12
12
13
13
import java
14
14
import semmle.code.java.dataflow.FlowSources
15
- import ResponseSplitting
15
+ import ServletResponseSplitting
16
16
import DataFlow:: PathGraph
17
17
18
18
class ResponseSplittingLocalConfig extends TaintTracking:: Configuration {
Original file line number Diff line number Diff line change 1
1
import java
2
2
import semmle.code.java.frameworks.Servlets
3
3
import semmle.code.java.dataflow.FlowSources
4
+ import semmle.code.java.security.ResponseSplitting
4
5
5
6
/**
6
7
* Header-splitting sinks. Expressions that end up in an HTTP header.
7
8
*/
8
- class HeaderSplittingSink extends DataFlow :: ExprNode {
9
- HeaderSplittingSink ( ) {
9
+ class ServletHeaderSplittingSink extends HeaderSplittingSink {
10
+ ServletHeaderSplittingSink ( ) {
10
11
exists ( ResponseAddCookieMethod m , MethodAccess ma |
11
12
ma .getMethod ( ) = m and
12
13
this .getExpr ( ) = ma .getArgument ( 0 )
@@ -30,8 +31,8 @@ class HeaderSplittingSink extends DataFlow::ExprNode {
30
31
}
31
32
}
32
33
33
- class WhitelistedSource extends DataFlow :: ExprNode {
34
- WhitelistedSource ( ) {
34
+ class TrustedServletSource extends TrustedSource {
35
+ TrustedServletSource ( ) {
35
36
this .asExpr ( ) .( MethodAccess ) .getMethod ( ) instanceof HttpServletRequestGetHeaderMethod or
36
37
this .asExpr ( ) .( MethodAccess ) .getMethod ( ) instanceof CookieGetNameMethod
37
38
}
Original file line number Diff line number Diff line change
1
+ import semmle.code.java.dataflow.DataFlow
2
+
3
+ /**
4
+ * Header-splitting sinks. Expressions that end up in an HTTP header.
5
+ */
6
+ abstract class HeaderSplittingSink extends DataFlow:: ExprNode { }
7
+
8
+ /**
9
+ * Sources that cannot be used to perform a header splitting attack.
10
+ */
11
+ abstract class TrustedSource extends DataFlow:: ExprNode { }
You can’t perform that action at this time.
0 commit comments