mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Python: Highlight problem with flow summaries and TAttributeContent
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# an empty file, since we want the test to run on an empty db
|
||||
@@ -0,0 +1,14 @@
|
||||
| compiled re.Match | Argument[self].Attribute[pattern] | Attribute[pattern] |
|
||||
| compiled re.Match | ReturnValue.Attribute[re].Attribute[pattern] | Attribute[pattern] |
|
||||
| compiled re.Match | ReturnValue.Attribute[re].Attribute[pattern] | Attribute[re] |
|
||||
| compiled re.Match | ReturnValue.Attribute[string] | Attribute[string] |
|
||||
| compiled re.subn | ReturnValue.TupleElement[0] | TupleElement[0] |
|
||||
| re.Match | ReturnValue.Attribute[re].Attribute[pattern] | Attribute[pattern] |
|
||||
| re.Match | ReturnValue.Attribute[re].Attribute[pattern] | Attribute[re] |
|
||||
| re.Match | ReturnValue.Attribute[string] | Attribute[string] |
|
||||
| re.Match.expand | Argument[self].Attribute[string] | Attribute[string] |
|
||||
| re.Match.group | Argument[self].Attribute[string] | Attribute[string] |
|
||||
| re.Match.groupdict | Argument[self].Attribute[string] | Attribute[string] |
|
||||
| re.Match.groups | Argument[self].Attribute[string] | Attribute[string] |
|
||||
| re.Pattern | ReturnValue.Attribute[pattern] | Attribute[pattern] |
|
||||
| re.subn | ReturnValue.TupleElement[0] | TupleElement[0] |
|
||||
@@ -0,0 +1,8 @@
|
||||
import python
|
||||
import semmle.python.dataflow.new.FlowSummary
|
||||
import semmle.python.dataflow.new.internal.FlowSummaryImpl
|
||||
|
||||
query predicate invalidSpecComponent(SummarizedCallable sc, string s, string c) {
|
||||
(sc.propagatesFlowExt(s, _, _) or sc.propagatesFlowExt(_, s, _)) and
|
||||
Private::External::invalidSpecComponent(s, c)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
| The attribute "pattern" is not a valid TAttributeContent, please add it to the hardcoded list of TAttributeContent in the dataflow library. |
|
||||
| The attribute "re" is not a valid TAttributeContent, please add it to the hardcoded list of TAttributeContent in the dataflow library. |
|
||||
| The attribute "string" is not a valid TAttributeContent, please add it to the hardcoded list of TAttributeContent in the dataflow library. |
|
||||
@@ -0,0 +1,11 @@
|
||||
import python
|
||||
import semmle.python.dataflow.new.FlowSummary
|
||||
import semmle.python.dataflow.new.internal.FlowSummaryImpl
|
||||
|
||||
from SummarizedCallable sc, string s, string c, string attr
|
||||
where
|
||||
(sc.propagatesFlowExt(s, _, _) or sc.propagatesFlowExt(_, s, _)) and
|
||||
Private::External::invalidSpecComponent(s, c) and
|
||||
c = "Attribute[" + attr + "]"
|
||||
select "The attribute \"" + attr +
|
||||
"\" is not a valid TAttributeContent, please add it to the hardcoded list of TAttributeContent in the dataflow library."
|
||||
Reference in New Issue
Block a user