mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Python: Reorganise code a bit to minimize diff for PR.
This commit is contained in:
@@ -26,9 +26,7 @@ class SQLInjectionConfiguration extends TaintTracking::Configuration {
|
||||
|
||||
SQLInjectionConfiguration() { this = "SQL injection configuration" }
|
||||
|
||||
override predicate isSource(TaintTracking::Source source) {
|
||||
source instanceof HttpRequestTaintSource
|
||||
}
|
||||
override predicate isSource(TaintTracking::Source source) { source instanceof HttpRequestTaintSource }
|
||||
|
||||
override predicate isSink(TaintTracking::Sink sink) { sink instanceof SqlInjectionSink }
|
||||
|
||||
|
||||
@@ -33,6 +33,3 @@ class StackTraceExposureConfiguration extends TaintTracking::Configuration {
|
||||
from StackTraceExposureConfiguration config, TaintedPathSource src, TaintedPathSink sink
|
||||
where config.hasFlowPath(src, sink)
|
||||
select sink.getSink(), src, sink, "$@ may be exposed to an external user", src.getSource(), "Error information"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@ class BrokenCryptoConfiguration extends TaintTracking::Configuration {
|
||||
|
||||
BrokenCryptoConfiguration() { this = "Broken crypto configuration" }
|
||||
|
||||
override predicate isSource(TaintTracking::Source source) {
|
||||
source instanceof SensitiveDataSource
|
||||
}
|
||||
override predicate isSource(TaintTracking::Source source) { source instanceof SensitiveDataSource }
|
||||
|
||||
override predicate isSink(TaintTracking::Sink sink) {
|
||||
sink instanceof WeakCryptoSink
|
||||
|
||||
@@ -2,7 +2,6 @@ import python
|
||||
import semmle.python.security.TaintTracking
|
||||
private import semmle.python.objects.ObjectInternal
|
||||
private import semmle.python.pointsto.Filters as Filters
|
||||
private import semmle.python.dataflow.Presentation
|
||||
|
||||
newtype TTaintTrackingContext =
|
||||
TNoParam()
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
import semmle.python.security.TaintTracking
|
||||
private import semmle.python.dataflow.Implementation
|
||||
private import semmle.python.dataflow.Presentation
|
||||
|
||||
|
||||
query predicate edges(TaintTrackingNode fromnode, TaintTrackingNode tonode) {
|
||||
TaintTrackingPresentation::pathEdge(fromnode, tonode, _)
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import python
|
||||
private import semmle.python.dataflow.Implementation
|
||||
|
||||
/** This module computed the flows from source to sink and edges to present to the user.
|
||||
* Depends on the `Implementation` module to compute taint.
|
||||
*/
|
||||
|
||||
module TaintTrackingPresentation {
|
||||
|
||||
predicate pathEdge(TaintTrackingNode src, TaintTrackingNode dest) {
|
||||
pathEdge(src, dest, _)
|
||||
}
|
||||
|
||||
predicate pathEdge(TaintTrackingNode src, TaintTrackingNode dest, string label) {
|
||||
exists(TaintTrackingNode source, TaintTrackingNode sink |
|
||||
source.getConfiguration().hasFlowPath(source, sink) and
|
||||
source.getASuccessor*() = src and
|
||||
src.getASuccessor(label) = dest and
|
||||
dest.getASuccessor*() = sink
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +1,20 @@
|
||||
import semmle.python.dataflow.Paths
|
||||
import semmle.python.dataflow.Implementation
|
||||
|
||||
module TaintTrackingPaths {
|
||||
|
||||
|
||||
predicate edge(TaintTrackingNode src, TaintTrackingNode dest, string label) {
|
||||
exists(TaintTrackingNode source, TaintTrackingNode sink |
|
||||
source.getConfiguration().hasFlowPath(source, sink) and
|
||||
source.getASuccessor*() = src and
|
||||
src.getASuccessor(label) = dest and
|
||||
dest.getASuccessor*() = sink
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
query predicate edges(TaintTrackingNode fromnode, TaintTrackingNode tonode) {
|
||||
TaintTrackingPaths::edge(fromnode, tonode, _)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user