Skip to content

Commit cd6d73d

Browse files
committed
Python: Handle kwarg in PyYAML
Really surprised that we didn't already :|
1 parent 6c0083e commit cd6d73d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python/ql/lib/semmle/python/frameworks/Yaml.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
private import python
1111
private import semmle.python.dataflow.new.DataFlow
12-
private import semmle.python.dataflow.new.RemoteFlowSources
1312
private import semmle.python.Concepts
1413
private import semmle.python.ApiGraphs
1514

@@ -63,7 +62,7 @@ private module Yaml {
6362
)
6463
}
6564

66-
override DataFlow::Node getAnInput() { result = this.getArg(0) }
65+
override DataFlow::Node getAnInput() { result in [this.getArg(0), this.getArgByName("stream")] }
6766

6867
override DataFlow::Node getOutput() { result = this }
6968

python/ql/test/library-tests/frameworks/yaml/Decoding.py

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

33
# Unsafe:
44
yaml.load(payload) # $decodeInput=payload decodeOutput=yaml.load(..) decodeFormat=YAML decodeMayExecuteInput
5+
yaml.load(stream=payload) # $decodeInput=payload decodeOutput=yaml.load(..) decodeFormat=YAML decodeMayExecuteInput
56
yaml.load(payload, yaml.Loader) # $decodeInput=payload decodeOutput=yaml.load(..) decodeFormat=YAML decodeMayExecuteInput
67
yaml.unsafe_load(payload) # $ decodeInput=payload decodeOutput=yaml.unsafe_load(..) decodeFormat=YAML decodeMayExecuteInput
78
yaml.full_load(payload) # $ decodeInput=payload decodeOutput=yaml.full_load(..) decodeFormat=YAML decodeMayExecuteInput

0 commit comments

Comments
 (0)