Skip to content

Commit 19872e9

Browse files
committed
More Feedback integration
1 parent 985d3d4 commit 19872e9

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

java/ql/src/Security/CWE/CWE-346/UnvalidatedCors.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
the <code>Access-Control-Allow-Origin</code> header when the
4949
<code>Access-Control-Allow-Credentials</code> header value is
5050
<code>true</code>.This can be done using a sandboxed iframe. A more detailed
51-
explanation is available in the portswigger blogpost.
51+
explanation is available in the portswigger blogpost referenced below.
5252

5353
</p>
5454
</recommendation>

java/ql/src/Security/CWE/CWE-346/UnvalidatedCors.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import DataFlow::PathGraph
1919
* Holds if `header` sets `Access-Control-Allow-Credentials` to `true`. This ensures fair chances of exploitability.
2020
*/
2121
private predicate setsAllowCredentials(MethodAccess header) {
22+
(
23+
header.getMethod() instanceof ResponseSetHeaderMethod or
24+
header.getMethod() instanceof ResponseAddHeaderMethod
25+
) and
2226
header.getArgument(0).(CompileTimeConstantExpr).getStringValue().toLowerCase() =
2327
"access-control-allow-credentials" and
2428
header.getArgument(1).(CompileTimeConstantExpr).getStringValue() = "true"
@@ -39,10 +43,6 @@ class CorsOriginConfig extends TaintTracking::Configuration {
3943
corsheader.getMethod() instanceof ResponseSetHeaderMethod or
4044
corsheader.getMethod() instanceof ResponseAddHeaderMethod
4145
) and
42-
(
43-
allowcredentialsheader.getMethod() instanceof ResponseSetHeaderMethod or
44-
allowcredentialsheader.getMethod() instanceof ResponseAddHeaderMethod
45-
) and
4646
getAccessControlAllowOriginHeaderName() = corsheader.getArgument(0) and
4747
setsAllowCredentials(allowcredentialsheader) and
4848
corsheader.getEnclosingCallable() = allowcredentialsheader.getEnclosingCallable() and

java/ql/test/stubs/apache-commons-lang3-3.7/org/apache/commons/lang3/StringUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
public class StringUtils {
44
public static boolean isEmpty(final CharSequence cs) {
5-
return cs == null || cs.length() == 0;
5+
return true;
66
}
77
}

0 commit comments

Comments
 (0)