From 0cdb5c48cfed8556c556c7009cabde2b21bde08c Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Wed, 17 Feb 2021 13:14:23 +0100 Subject: [PATCH] Python: Remove type-tracking snippets for framework modeling We won't need these anymore, since we can now use API graphs --- python/.vscode/ql.code-snippets | 200 -------------------------------- 1 file changed, 200 deletions(-) diff --git a/python/.vscode/ql.code-snippets b/python/.vscode/ql.code-snippets index 6ccb9aa6657..59f230193b0 100644 --- a/python/.vscode/ql.code-snippets +++ b/python/.vscode/ql.code-snippets @@ -123,92 +123,6 @@ "description": "Type tracking predicate", }, - "Type tracking module": { - "scope": "ql", - "prefix": "type tracking module", - "body": [ - "// ---------------------------------------------------------------------------", - "// ${1:modulename}", - "// ---------------------------------------------------------------------------", - "/** Gets a reference to the `$1` module. */", - "private DataFlow::Node $1(DataFlow::TypeTracker t) {", - " t.start() and", - " result = DataFlow::importNode(\"$1\")", - " or", - " exists(DataFlow::TypeTracker t2 | result = $1(t2).track(t2, t))", - "}", - "", - "/** Gets a reference to the `$1` module. */", - "DataFlow::Node $1() { result = $1(DataFlow::TypeTracker::end()) }", - "", - "/**", - " * Gets a reference to the attribute `attr_name` of the `$1` module.", - " * WARNING: Only holds for a few predefined attributes.", - " */", - "private DataFlow::Node $1_attr(DataFlow::TypeTracker t, string attr_name) {", - " attr_name in [\"${2:name}\"] and", - " (", - " t.start() and", - " result = DataFlow::importNode(\"$1\" + \".\" + attr_name)", - " or", - " t.startInAttr(attr_name) and", - " result = $1()", - " )", - " or", - " // Due to bad performance when using normal setup with `$1_attr(t2, attr_name).track(t2, t)`", - " // we have inlined that code and forced a join", - " exists(DataFlow::TypeTracker t2 |", - " exists(DataFlow::StepSummary summary |", - " $1_attr_first_join(t2, attr_name, result, summary) and", - " t = t2.append(summary)", - " )", - " )", - "}", - "", - "pragma[nomagic]", - "private predicate $1_attr_first_join(", - " DataFlow::TypeTracker t2, string attr_name, DataFlow::Node res, DataFlow::StepSummary summary", - ") {", - " DataFlow::StepSummary::step($1_attr(t2, attr_name), res, summary)", - "}", - "", - "/**", - " * Gets a reference to the attribute `attr_name` of the `$1` module.", - " * WARNING: Only holds for a few predefined attributes.", - " */", - "private DataFlow::Node $1_attr(string attr_name) {", - " result = $1_attr(DataFlow::TypeTracker::end(), attr_name)", - "}", - "", - "/** Provides models for the `$1` module. */", - "module $1 {", - "", - "}", - ], - "description": "Type tracking module", - }, - - "Type tracking module member": { - "scope": "ql", - "prefix": "type tracking module member", - "body": [ - "/** Gets a reference to the `${1:module}.${2:member}` ${3:object/class}. */", - "private DataFlow::Node ${4:$2}(DataFlow::TypeTracker t) {", - " t.start() and", - " result = DataFlow::importNode(\"$1.$2\")", - " or", - " t.startInAttr(\"$2\") and", - " result = $1()", - " or", - " exists(DataFlow::TypeTracker t2 | result = $4(t2).track(t2, t))", - "}", - " ", - "/** Gets a reference to the `$1.$2` $3. */", - "DataFlow::Node $4() { result = $4(DataFlow::TypeTracker::end()) }", - ], - "description": "Type tracking module member", - }, - "Taint tracking configuration": { "scope": "ql", "prefix": "taint tracking", @@ -238,118 +152,4 @@ ] }, - "Type tracking submodule": { - "scope": "ql", - "prefix": "type tracking submodule", - "body": [ - " // -------------------------------------------------------------------------", - " // ${1:parent}.${2:submodule}", - " // -------------------------------------------------------------------------", - " /** Gets a reference to the `$1.$2` module. */", - " DataFlow::Node $2() { result = $1_attr(\"$2\") }", - "", - " /** Provides models for the `$1.$2` module */", - " module $2 {", - " /**", - " * Gets a reference to the attribute `attr_name` of the `$1.$2` module.", - " * WARNING: Only holds for a few predefined attributes.", - " */", - " private DataFlow::Node $2_attr(DataFlow::TypeTracker t, string attr_name) {", - " attr_name in [\"$3\"] and", - " (", - " t.start() and", - " result = DataFlow::importNode(\"$1.$2\" + \".\" + attr_name)", - " or", - " t.startInAttr(attr_name) and", - " result = $2()", - " )", - " or", - " // Due to bad performance when using normal setup with `$2_attr(t2, attr_name).track(t2, t)`", - " // we have inlined that code and forced a join", - " exists(DataFlow::TypeTracker t2 |", - " exists(DataFlow::StepSummary summary |", - " $2_attr_first_join(t2, attr_name, result, summary) and", - " t = t2.append(summary)", - " )", - " )", - " }", - "", - " pragma[nomagic]", - " private predicate $2_attr_first_join(", - " DataFlow::TypeTracker t2, string attr_name, DataFlow::Node res,", - " DataFlow::StepSummary summary", - " ) {", - " DataFlow::StepSummary::step($2_attr(t2, attr_name), res, summary)", - " }", - "", - " /**", - " * Gets a reference to the attribute `attr_name` of the `$1.$2` module.", - " * WARNING: Only holds for a few predefined attributes.", - " */", - " private DataFlow::Node $2_attr(string attr_name) {", - " result = $2_attr(DataFlow::TypeTracker::end(), attr_name)", - " }", - " }", - ], - "description": "Type tracking submodule", - }, - - "Type tracking class": { - "scope": "ql", - "prefix": "type tracking class", - "body": [ - " /**", - " * Provides models for the `${1:module}.${2:classname}` class", - " *", - " * See ${6:apiref}.", - " */", - " module $2 {", - " /** Gets a reference to the `$1.$2` class. */", - " private DataFlow::Node classRef(DataFlow::TypeTracker t) {", - " t.start() and", - " result = ${4:module}_attr(\"$2\")", - " or", - " // TODO: remove/expand this part of the template as needed", - " // Handle `${5:toplevel}.$2` alias", - " t.start() and", - " result = $5_attr(\"$2\")", - " or", - " exists(DataFlow::TypeTracker t2 | result = classRef(t2).track(t2, t))", - " }", - "", - " /** Gets a reference to the `$1.$2` class. */", - " DataFlow::Node classRef() { result = classRef(DataFlow::TypeTracker::end()) }", - "", - " /**", - " * A source of instances of `$1.$2`, extend this class to model new instances.", - " *", - " * This can include instantiations of the class, return values from function", - " * calls, or a special parameter that will be set when functions are called by an external", - " * library.", - " *", - " * Use the predicate `$2::instance()` to get references to instances of `$1.$2`.", - " */", - " abstract class InstanceSource extends DataFlow::Node { }", - "", - " /** A direct instantiation of `$1.$2`. */", - " private class ClassInstantiation extends InstanceSource, DataFlow::CfgNode {", - " override CallNode node;", - "", - " ClassInstantiation() { node.getFunction() = classRef().asCfgNode() }", - " }", - "", - " /** Gets a reference to an instance of `$1.$2`. */", - " private DataFlow::Node instance(DataFlow::TypeTracker t) {", - " t.start() and", - " result instanceof InstanceSource", - " or", - " exists(DataFlow::TypeTracker t2 | result = instance(t2).track(t2, t))", - " }", - "", - " /** Gets a reference to an instance of `$1.$2`. */", - " DataFlow::Node instance() { result = instance(DataFlow::TypeTracker::end()) }", - " }", - ], - "description": "Type tracking class", - }, }