Skip to content

Commit ef3bbea

Browse files
Add check for kwargs in cookie attribute predicates
1 parent 90e87a1 commit ef3bbea

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,7 @@ module Http {
12341234
)
12351235
or
12361236
not exists(this.getArgByName("secure")) and
1237+
not exists(this.getKwargs()) and
12371238
b = false
12381239
}
12391240

@@ -1246,6 +1247,7 @@ module Http {
12461247
)
12471248
or
12481249
not exists(this.getArgByName("httponly")) and
1250+
not exists(this.getKwargs()) and
12491251
b = false
12501252
}
12511253

@@ -1267,6 +1269,7 @@ module Http {
12671269
)
12681270
or
12691271
not exists(this.getArgByName("samesite")) and
1272+
not exists(this.getKwargs()) and
12701273
v instanceof CookieWrite::SameSiteLax // Lax is the default
12711274
}
12721275
}

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ class CallCfgNode extends CfgNode, LocalSourceNode {
219219

220220
/** Gets the data-flow node corresponding to the named argument of the call corresponding to this data-flow node */
221221
Node getArgByName(string name) { result.asCfgNode() = node.getArgByName(name) }
222+
223+
/** Gets the data-flow node corresponding to the first tuple (*) argument of the call corresponding to this data-flow node, if any. */
224+
Node getStarArg() { result.asCfgNode() = node.getStarArg() }
225+
226+
/** Gets tje data-flow node corresponding to a dictionary (**) argument of the call corresponding to this data-flow node, if any. */
227+
Node getKwargs() { result.asCfgNode() = node.getKwargs() }
222228
}
223229

224230
/**

0 commit comments

Comments
 (0)