Skip to content

Commit 170be9f

Browse files
committed
Move UrlRedirectSink into importable library
- The `UrlRedirect` class is renamed to `ServletUrlRedirect`. - Abstract class `UrlRedirectSink` is defined that can be imported and used to customise CWE-601 via Customizations.qll
1 parent c166fee commit 170be9f

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

java/ql/src/Security/CWE/CWE-601/UrlRedirect.qll renamed to java/ql/src/Security/CWE/CWE-601/ServletUrlRedirect.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import java
22
import semmle.code.java.frameworks.Servlets
33
import semmle.code.java.dataflow.DataFlow
4+
import semmle.code.java.security.UrlRedirect
45

56
/**
6-
* A URL redirection sink.
7+
* A Servlet URL redirection sink.
78
*/
8-
class UrlRedirectSink extends DataFlow::ExprNode {
9-
UrlRedirectSink() {
9+
class ServletUrlRedirectSink extends UrlRedirectSink {
10+
ServletUrlRedirectSink() {
1011
exists(MethodAccess ma |
1112
ma.getMethod() instanceof HttpServletResponseSendRedirectMethod and
1213
this.asExpr() = ma.getArgument(0)

java/ql/src/Security/CWE/CWE-601/UrlRedirect.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import java
1414
import semmle.code.java.dataflow.FlowSources
15-
import UrlRedirect
15+
import ServletUrlRedirect
1616
import DataFlow::PathGraph
1717

1818
class UrlRedirectConfig extends TaintTracking::Configuration {

java/ql/src/Security/CWE/CWE-601/UrlRedirectLocal.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import java
1414
import semmle.code.java.dataflow.FlowSources
15-
import UrlRedirect
15+
import ServletUrlRedirect
1616
import DataFlow::PathGraph
1717

1818
class UrlRedirectLocalConfig extends TaintTracking::Configuration {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import java
2+
import semmle.code.java.dataflow.DataFlow
3+
4+
/** A URL redirection sink */
5+
abstract class UrlRedirectSink extends DataFlow::ExprNode { }

0 commit comments

Comments
 (0)