Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 91aefab

Browse files
committed
Python: Reorganise code a bit to minimize diff for PR.
1 parent e590092 commit 91aefab

7 files changed

Lines changed: 22 additions & 44 deletions

File tree

python/ql/src/Security/CWE-089/SqlInjection.ql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class SQLInjectionConfiguration extends TaintTracking::Configuration {
2626

2727
SQLInjectionConfiguration() { this = "SQL injection configuration" }
2828

29-
override predicate isSource(TaintTracking::Source source) {
30-
source instanceof HttpRequestTaintSource
31-
}
29+
override predicate isSource(TaintTracking::Source source) { source instanceof HttpRequestTaintSource }
3230

3331
override predicate isSink(TaintTracking::Sink sink) { sink instanceof SqlInjectionSink }
3432

python/ql/src/Security/CWE-209/StackTraceExposure.ql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@ class StackTraceExposureConfiguration extends TaintTracking::Configuration {
3333
from StackTraceExposureConfiguration config, TaintedPathSource src, TaintedPathSink sink
3434
where config.hasFlowPath(src, sink)
3535
select sink.getSink(), src, sink, "$@ may be exposed to an external user", src.getSource(), "Error information"
36-
37-
38-

python/ql/src/Security/CWE-327/BrokenCryptoAlgorithm.ql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ class BrokenCryptoConfiguration extends TaintTracking::Configuration {
1616

1717
BrokenCryptoConfiguration() { this = "Broken crypto configuration" }
1818

19-
override predicate isSource(TaintTracking::Source source) {
20-
source instanceof SensitiveDataSource
21-
}
19+
override predicate isSource(TaintTracking::Source source) { source instanceof SensitiveDataSource }
2220

2321
override predicate isSink(TaintTracking::Sink sink) {
2422
sink instanceof WeakCryptoSink

python/ql/src/semmle/python/dataflow/Implementation.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import python
22
import semmle.python.security.TaintTracking
33
private import semmle.python.objects.ObjectInternal
44
private import semmle.python.pointsto.Filters as Filters
5-
private import semmle.python.dataflow.Presentation
65

76
newtype TTaintTrackingContext =
87
TNoParam()

python/ql/src/semmle/python/dataflow/Paths.qll

Lines changed: 0 additions & 10 deletions
This file was deleted.

python/ql/src/semmle/python/dataflow/Presentation.qll

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
import semmle.python.dataflow.Paths
1+
import semmle.python.dataflow.Implementation
2+
3+
module TaintTrackingPaths {
4+
5+
6+
predicate edge(TaintTrackingNode src, TaintTrackingNode dest, string label) {
7+
exists(TaintTrackingNode source, TaintTrackingNode sink |
8+
source.getConfiguration().hasFlowPath(source, sink) and
9+
source.getASuccessor*() = src and
10+
src.getASuccessor(label) = dest and
11+
dest.getASuccessor*() = sink
12+
)
13+
}
14+
15+
}
16+
17+
18+
query predicate edges(TaintTrackingNode fromnode, TaintTrackingNode tonode) {
19+
TaintTrackingPaths::edge(fromnode, tonode, _)
20+
}

0 commit comments

Comments
 (0)