Skip to content

Commit a4204cc

Browse files
committed
Avoid using Str_ internal class
1 parent 6ecb6d1 commit a4204cc

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

python/ql/src/experimental/semmle/python/frameworks/Django.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,12 @@ private module PrivateDjango {
175175
}
176176

177177
override predicate isSameSite() {
178-
this.(DataFlow::CallCfgNode).getArgByName("samesite").asExpr().(Str_).getS() in [
179-
"Strict", "Lax"
180-
]
178+
exists(StrConst str |
179+
str.getText() in ["Strict", "Lax"] and
180+
DataFlow::exprNode(str)
181+
.(DataFlow::LocalSourceNode)
182+
.flowsTo(this.(DataFlow::CallCfgNode).getArgByName("samesite"))
183+
)
181184
}
182185

183186
override DataFlow::Node getHeaderArg() { none() }

python/ql/src/experimental/semmle/python/frameworks/Flask.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ module ExperimentalFlask {
121121
}
122122

123123
override predicate isSameSite() {
124-
this.(DataFlow::CallCfgNode).getArgByName("samesite").asExpr().(Str_).getS() in [
125-
"Strict", "Lax"
126-
]
124+
exists(StrConst str |
125+
str.getText() in ["Strict", "Lax"] and
126+
DataFlow::exprNode(str)
127+
.(DataFlow::LocalSourceNode)
128+
.flowsTo(this.(DataFlow::CallCfgNode).getArgByName("samesite"))
129+
)
127130
}
128131

129132
override DataFlow::Node getHeaderArg() { none() }

0 commit comments

Comments
 (0)