mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python taint-tracking: update test results.
This commit is contained in:
@@ -700,6 +700,15 @@ module DataFlow {
|
||||
|
||||
abstract Location getLocation();
|
||||
|
||||
AstNode asAstNode() {
|
||||
result = this.asCfgNode().getNode()
|
||||
}
|
||||
|
||||
/** For backwards compatibility -- Use asAstNode() instead */
|
||||
deprecated AstNode getNode() {
|
||||
result = this.asAstNode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CfgNode extends Node, TCfgNode {
|
||||
|
||||
@@ -10,7 +10,14 @@ class SimpleTest extends TaintKind {
|
||||
|
||||
}
|
||||
|
||||
class SimpleConfig extends TaintTracking::Configuration {
|
||||
abstract class TestConfig extends TaintTracking::Configuration {
|
||||
|
||||
bindingset[this]
|
||||
TestConfig() { any() }
|
||||
|
||||
}
|
||||
|
||||
class SimpleConfig extends TestConfig {
|
||||
|
||||
SimpleConfig() { this = "Simple config" }
|
||||
|
||||
@@ -49,7 +56,7 @@ class BasicCustomTaint extends TaintKind {
|
||||
}
|
||||
|
||||
|
||||
class BasicCustomConfig extends TaintTracking::Configuration {
|
||||
class BasicCustomConfig extends TestConfig {
|
||||
|
||||
BasicCustomConfig() { this = "Basic custom config" }
|
||||
|
||||
@@ -99,7 +106,7 @@ class Scissors extends TaintKind {
|
||||
|
||||
}
|
||||
|
||||
class RockPaperScissorConfig extends TaintTracking::Configuration {
|
||||
class RockPaperScissorConfig extends TestConfig {
|
||||
|
||||
RockPaperScissorConfig() { this = "Rock-paper-scissors config" }
|
||||
|
||||
@@ -145,7 +152,7 @@ class TaintCarrier extends TaintKind {
|
||||
|
||||
}
|
||||
|
||||
class TaintCarrierConfig extends TaintTracking::Configuration {
|
||||
class TaintCarrierConfig extends TestConfig {
|
||||
|
||||
TaintCarrierConfig() { this = "Taint carrier config" }
|
||||
|
||||
@@ -327,5 +334,3 @@ class TaintIterableSource extends TaintSource {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,5 +9,6 @@ import semmle.python.dataflow.Implementation
|
||||
|
||||
from TaintTrackingImplementation config, TaintTrackingNode src, CallNode call,
|
||||
TaintTrackingContext caller, CallableValue pyfunc, int arg, AttributePath path, TaintKind kind
|
||||
where config.callWithTaintedArgument(src, call, caller, pyfunc, arg, path, kind)
|
||||
where config instanceof TestConfig and
|
||||
config.callWithTaintedArgument(src, call, caller, pyfunc, arg, path, kind)
|
||||
select config, src, call, caller, pyfunc, arg, path, kind
|
||||
|
||||
@@ -5,5 +5,6 @@ import TaintLib
|
||||
|
||||
|
||||
from TaintTrackingNode n
|
||||
where n.getConfiguration() instanceof TestConfig
|
||||
select n.getTaintKind(), n.getLocation().toString(), n.getNode().toString(), n.getPath().toString(), n.getContext().toString()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import python
|
||||
import semmle.python.security.TaintTracking
|
||||
import TaintLib
|
||||
|
||||
from TaintTracking::Configuration config, DataFlow::Node sink, TaintKind kind
|
||||
from TestConfig config, DataFlow::Node sink, TaintKind kind
|
||||
|
||||
where config.isSink(sink, kind)
|
||||
select config, sink.getLocation().toString(), sink.getLocation().getStartLine(), sink.toString(), kind
|
||||
|
||||
@@ -2,7 +2,7 @@ import python
|
||||
import semmle.python.security.TaintTracking
|
||||
import TaintLib
|
||||
|
||||
from TaintTracking::Configuration config, DataFlow::Node source, TaintKind kind
|
||||
from TestConfig config, DataFlow::Node source, TaintKind kind
|
||||
|
||||
where config.isSource(source, kind)
|
||||
select config, source.getLocation().toString(), source.getLocation().getStartLine(), source.toString(), kind
|
||||
|
||||
@@ -4,7 +4,7 @@ import TaintLib
|
||||
import semmle.python.dataflow.Implementation
|
||||
|
||||
|
||||
from TaintTrackingNode n, TaintTrackingNode s, TaintTracking::Configuration config
|
||||
from TaintTrackingNode n, TaintTrackingNode s, TestConfig config
|
||||
where s = n.getASuccessor() and config = n.getConfiguration()
|
||||
select
|
||||
config + ":",
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
ERROR: getNode() cannot be resolved for type Node (TestNode.ql:5,69-76)
|
||||
ERROR: getTrackedValue() cannot be resolved for type TaintedNode (TestNode.ql:5,10-25)
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (TestNode.ql:5,77-84)
|
||||
|
||||
@@ -2,4 +2,4 @@ import python
|
||||
import Config
|
||||
|
||||
from TaintedNode n
|
||||
select n.getTrackedValue(), n.getLocation().toString(), n.getNode().getNode().toString(), n.getContext()
|
||||
select "Taint " + n.getTaintKind(), n.getLocation().toString(), n.getNode().getNode().toString(), n.getContext()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (TestNode.ql:8,43-50)
|
||||
| test.py:10:11:10:47 | test.py:10 | MyException() | exception.kind |
|
||||
| test.py:15:25:15:25 | test.py:15 | e | exception.kind |
|
||||
| test.py:16:13:16:34 | test.py:16 | Attribute() | exception.info |
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (TestStep.ql:12,74-81)
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (TestStep.ql:14,74-81)
|
||||
| Taint [exception.info] | test.py:19 | Attribute() | | --> | Taint [exception.info] | test.py:21 | t | |
|
||||
| Taint [exception.info] | test.py:19 | Attribute() | | --> | Taint [exception.info] | test.py:27 | t | |
|
||||
| Taint [exception.info] | test.py:20 | Attribute() | | --> | Taint [exception.info] | test.py:27 | u | |
|
||||
|
||||
@@ -9,6 +9,6 @@ where
|
||||
not n.getLocation().getFile().inStdlib() and
|
||||
not s.getLocation().getFile().inStdlib()
|
||||
select
|
||||
n.getTrackedValue(), n.getLocation().toString(), n.getNode().getNode().toString(), n.getContext(),
|
||||
"Taint " + n.getTaintKind(), n.getLocation().toString(), n.getNode().getNode().toString(), n.getContext(),
|
||||
" --> ",
|
||||
s.getTrackedValue(), s.getLocation().toString(), s.getNode().getNode().toString(), s.getContext()
|
||||
"Taint " + n.getTaintKind(), s.getLocation().toString(), s.getNode().getNode().toString(), s.getContext()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (/home/mark/repos/ql/python/ql/test/library-tests/web/turbogears/Taint.ql:12,54-61)
|
||||
| ../../../query-tests/Security/lib/bottle.py:64 | LocalRequest() | bottle.request |
|
||||
| ../../../query-tests/Security/lib/bottle.py:64 | request | bottle.request |
|
||||
| ../../../query-tests/Security/lib/bottle.py:68 | url | externally controlled string |
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
| test.py:17 | Attribute() | externally controlled string |
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (Taint.ql:12,54-61)
|
||||
| test.py:9 | req | falcon.request |
|
||||
| test.py:9 | resp | falcon.response |
|
||||
| test.py:10 | Attribute | file[externally controlled string] |
|
||||
@@ -8,7 +9,6 @@
|
||||
| test.py:12 | resp | falcon.response |
|
||||
| test.py:13 | Dict | {json[externally controlled string]} |
|
||||
| test.py:15 | result | json[externally controlled string] |
|
||||
| test.py:17 | resp | falcon.response |
|
||||
| test.py:17 | result | {json[externally controlled string]} |
|
||||
| test.py:19 | req | falcon.request |
|
||||
| test.py:19 | resp | falcon.response |
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
WARNING: Predicate getNode has been deprecated and may be removed in future (Taint.ql:12,54-61)
|
||||
| test.py:18 | b | externally controlled string |
|
||||
| test.py:19 | BinaryExpr | [externally controlled string] |
|
||||
| test.py:19 | BinaryExpr | externally controlled string |
|
||||
|
||||
Reference in New Issue
Block a user