mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
Python: Move concept tests out
These tests should be fleshed out at some point, but currently they test all that we model.
This commit is contained in:
@@ -20,6 +20,7 @@ private module Dill {
|
||||
/** Gets a reference to the `dill` module. */
|
||||
DataFlow::Node dill() { result = dill(DataFlow::TypeTracker::end()) }
|
||||
|
||||
/** Provides models for the `dill` module. */
|
||||
module dill {
|
||||
/** Gets a reference to the `dill.loads` function. */
|
||||
private DataFlow::Node loads(DataFlow::TypeTracker t) {
|
||||
@@ -55,5 +56,10 @@ private class DillDeserialization extends UnmarshalingFunction::Range {
|
||||
|
||||
override DataFlow::Node getOutput() { result = this }
|
||||
|
||||
override string getFormat() { none() }
|
||||
override string getFormat() {
|
||||
result = this.asCfgNode().(CallNode).getArgByName("encoding").(NameNode).getId()
|
||||
or
|
||||
not exists(this.asCfgNode().(CallNode).getArgByName("encoding")) and
|
||||
result = "ASCII"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ private module Stdlib {
|
||||
/** Gets a reference to the `marshal` module. */
|
||||
DataFlow::Node marshal() { result = marshal(DataFlow::TypeTracker::end()) }
|
||||
|
||||
/** Provides models for the `marshal` module. */
|
||||
module marshal {
|
||||
/** Gets a reference to the `marshal.loads` function. */
|
||||
private DataFlow::Node loads(DataFlow::TypeTracker t) {
|
||||
@@ -394,6 +395,7 @@ private module Stdlib {
|
||||
/** Gets a reference to the `pickle` module. */
|
||||
DataFlow::Node pickle() { result = pickle(DataFlow::TypeTracker::end()) }
|
||||
|
||||
/** Provides models for the `pickle` module. */
|
||||
module pickle {
|
||||
/** Gets a reference to the `pickle.loads` function. */
|
||||
private DataFlow::Node loads(DataFlow::TypeTracker t) {
|
||||
@@ -429,6 +431,9 @@ private module Stdlib {
|
||||
|
||||
override string getFormat() {
|
||||
result = this.asCfgNode().(CallNode).getArgByName("encoding").(NameNode).getId()
|
||||
or
|
||||
not exists(this.asCfgNode().(CallNode).getArgByName("encoding")) and
|
||||
result = "ASCII"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ private module Yaml {
|
||||
/** Gets a reference to the `yaml` module. */
|
||||
DataFlow::Node yaml() { result = yaml(DataFlow::TypeTracker::end()) }
|
||||
|
||||
/** Provides models for the `yaml` module. */
|
||||
module yaml {
|
||||
/** Gets a reference to the `yaml.load` function. */
|
||||
private DataFlow::Node load(DataFlow::TypeTracker t) {
|
||||
|
||||
Reference in New Issue
Block a user