Skip to content

Commit c7f9095

Browse files
Apply similar changes to httponly
1 parent 1127b08 commit c7f9095

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

python/ql/lib/semmle/python/Concepts.qll

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,19 +1268,16 @@ module Http {
12681268
* Holds if the `HttpOnly` flag of the cookie is known to have a value of `b`.
12691269
*/
12701270
predicate hasHttpOnlyFlag(boolean b) {
1271-
exists(this.getHeaderArg()) and
1272-
(
1273-
exists(StringLiteral sl |
1274-
sl.getText().regexpMatch("(?i).*;\\s*httponly(;.*|\\s*)") and
1275-
TaintTracking::localTaint(DataFlow::exprNode(sl), this.getHeaderArg()) and
1276-
b = true
1277-
)
1271+
exists(StringLiteral sl |
1272+
// `sl` is likely a substring of the header
1273+
TaintTracking::localTaint(DataFlow::exprNode(sl), this.getHeaderArg()) and
1274+
sl.getText().regexpMatch("(?i).*;\\s*httponly(;.*|\\s*)") and
1275+
b = true
12781276
or
1279-
exists(StringLiteral sl |
1280-
not sl.getText().regexpMatch("(?i).*;\\s*httponly(;.*|\\s*)") and
1281-
DataFlow::localFlow(DataFlow::exprNode(sl), this.getHeaderArg()) and
1282-
b = false
1283-
)
1277+
// `sl` is the entire header
1278+
DataFlow::localFlow(DataFlow::exprNode(sl), this.getHeaderArg()) and
1279+
not sl.getText().regexpMatch("(?i).*;\\s*httponly(;.*|\\s*)") and
1280+
b = false
12841281
)
12851282
}
12861283

0 commit comments

Comments
 (0)