mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Add remoteflowsoucre test
This commit is contained in:
20
python/ql/test/experimental/meta/RemoteFlowSourceTest.qll
Normal file
20
python/ql/test/experimental/meta/RemoteFlowSourceTest.qll
Normal file
@@ -0,0 +1,20 @@
|
||||
import python
|
||||
import semmle.python.dataflow.new.RemoteFlowSources
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
private import semmle.python.dataflow.new.internal.PrintNode
|
||||
|
||||
module SourceTest implements TestSig {
|
||||
string getARelevantTag() { result = "source" }
|
||||
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(location.getFile().getRelativePath()) and
|
||||
exists(RemoteFlowSource rfs |
|
||||
location = rfs.getLocation() and
|
||||
element = rfs.toString() and
|
||||
value = prettyNode(rfs) and
|
||||
tag = "source"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<SourceTest>
|
||||
@@ -1,20 +1,2 @@
|
||||
import python
|
||||
import semmle.python.dataflow.new.RemoteFlowSources
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
private import semmle.python.dataflow.new.internal.PrintNode
|
||||
|
||||
module SourceTest implements TestSig {
|
||||
string getARelevantTag() { result = "source" }
|
||||
|
||||
predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||
exists(location.getFile().getRelativePath()) and
|
||||
exists(RemoteFlowSource rfs |
|
||||
location = rfs.getLocation() and
|
||||
element = rfs.toString() and
|
||||
value = prettyNode(rfs) and
|
||||
tag = "source"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import MakeTest<SourceTest>
|
||||
import experimental.meta.RemoteFlowSourceTest
|
||||
|
||||
@@ -15,3 +15,13 @@ q = conn.query("some sql") # $ getSql="some sql"
|
||||
c = conn.connect()
|
||||
|
||||
c.execute("other sql") # $ getSql="other sql"
|
||||
|
||||
# SQL Alchemy session
|
||||
s = conn.session
|
||||
|
||||
s.execute("yet another sql") # $ getSql="yet another sql"
|
||||
|
||||
# SQL Alchemy engine
|
||||
e = st.connection("postgresql", type="sql")
|
||||
|
||||
e.engine.connect().execute("yet yet another sql") # $ getSql="yet yet another sql"
|
||||
|
||||
Reference in New Issue
Block a user