mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Merge pull request #8796 from erik-krogh/redundantImport
Remove redundant imports
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
import semmle.code.cpp.Variable
|
||||
import semmle.code.cpp.Enum
|
||||
import semmle.code.cpp.exprs.Access
|
||||
|
||||
/**
|
||||
* A C structure member or C++ non-static member variable. For example the
|
||||
|
||||
@@ -11,7 +11,6 @@ private import TranslatedDeclarationEntry
|
||||
private import TranslatedElement
|
||||
private import TranslatedFunction
|
||||
private import TranslatedInitialization
|
||||
private import TranslatedFunction
|
||||
private import TranslatedStmt
|
||||
private import TranslatedGlobalVar
|
||||
import TranslatedCall
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import semmle.code.cpp.Function
|
||||
import semmle.code.cpp.models.interfaces.ArrayFunction
|
||||
import semmle.code.cpp.models.interfaces.ArrayFunction
|
||||
import semmle.code.cpp.models.interfaces.Alias
|
||||
import semmle.code.cpp.models.interfaces.SideEffect
|
||||
import semmle.code.cpp.models.interfaces.Taint
|
||||
|
||||
@@ -1802,5 +1802,3 @@ module SimpleRangeAnalysisInternal {
|
||||
defMightOverflowNegatively(def, v) and result = varMaxVal(v)
|
||||
}
|
||||
}
|
||||
|
||||
private import SimpleRangeAnalysisInternal
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import semmle.code.cpp.commons.Alloc
|
||||
import semmle.code.cpp.commons.Buffer
|
||||
import semmle.code.cpp.commons.Scanf
|
||||
import semmle.code.cpp.models.implementations.Strcat
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
import cpp
|
||||
import LeapYear
|
||||
import semmle.code.cpp.dataflow.DataFlow
|
||||
|
||||
from Expr source, Expr sink, PossibleYearArithmeticOperationCheckConfiguration config
|
||||
where config.hasFlow(DataFlow::exprNode(source), DataFlow::exprNode(sink))
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import cpp
|
||||
import NtohlArrayNoBound
|
||||
import semmle.code.cpp.dataflow.DataFlow
|
||||
|
||||
from NetworkToBufferSizeConfiguration bufConfig, DataFlow::Node source, DataFlow::Node sink
|
||||
where bufConfig.hasFlow(source, sink)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import semmle.code.cpp.security.BufferWrite
|
||||
import semmle.code.cpp.commons.Alloc
|
||||
|
||||
/*
|
||||
* See CWE-120/UnboundedWrite.ql for a summary of CWE-120 alert cases.
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import semmle.code.cpp.security.BufferWrite
|
||||
import semmle.code.cpp.commons.Alloc
|
||||
|
||||
/*
|
||||
* See CWE-120/UnboundedWrite.ql for a summary of CWE-120 alert cases.
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import semmle.code.cpp.exprs.BitwiseOperation
|
||||
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import semmle.code.cpp.ir.dataflow.DataFlow
|
||||
import IRConfiguration
|
||||
import cpp
|
||||
import DataFlow::PathGraph
|
||||
|
||||
from DataFlow::PathNode src, DataFlow::PathNode sink, IRConf conf
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import semmle.code.cpp.dataflow.DataFlow
|
||||
import ASTConfiguration
|
||||
import cpp
|
||||
import DataFlow::PathGraph
|
||||
|
||||
from DataFlow::PathNode src, DataFlow::PathNode sink, AstConf conf
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
private import csharp
|
||||
private import AssignableDefinitions
|
||||
private import SsaImpl as SsaImpl
|
||||
private import semmle.code.csharp.dataflow.SSA
|
||||
|
||||
class BasicBlock = ControlFlow::BasicBlock;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import Expr
|
||||
import semmle.code.csharp.Callable
|
||||
import semmle.code.csharp.dataflow.CallContext as CallContext
|
||||
private import semmle.code.csharp.dataflow.internal.DelegateDataFlow
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowDispatch
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import Expr
|
||||
import semmle.code.csharp.Callable
|
||||
private import semmle.code.csharp.frameworks.system.linq.Expressions
|
||||
private import semmle.code.csharp.TypeRef
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import Dynamic
|
||||
import Literal
|
||||
import LogicalOperation
|
||||
import semmle.code.csharp.controlflow.ControlFlowElement
|
||||
import semmle.code.csharp.Callable
|
||||
import semmle.code.csharp.Location
|
||||
import semmle.code.csharp.Stmt
|
||||
import semmle.code.csharp.Type
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import csharp
|
||||
private import semmle.code.csharp.dataflow.flowsources.Remote
|
||||
private import semmle.code.csharp.dataflow.TaintTracking
|
||||
private import semmle.code.csharp.frameworks.System
|
||||
private import semmle.code.csharp.dataflow.FlowSummary
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.DataFlow
|
||||
import csharp
|
||||
|
||||
class ImplementsICryptoTransform extends Class {
|
||||
ImplementsICryptoTransform() {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
import csharp
|
||||
import DataFlow::PathGraph
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
|
||||
class UnsafeYearCreationFromArithmeticConfiguration extends TaintTracking::Configuration {
|
||||
UnsafeYearCreationFromArithmeticConfiguration() {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.DataFlow
|
||||
|
||||
abstract class ParallelSink extends DataFlow::Node { }
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.DataFlow
|
||||
import ParallelSink
|
||||
import ICryptoTransform
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
import semmle.code.csharp.security.dataflow.ExternalAPIsQuery
|
||||
import DataFlow::PathGraph
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.security.dataflow.flowsources.Remote
|
||||
import semmle.code.csharp.security.dataflow.flowsources.Local
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
import semmle.code.csharp.frameworks.Format
|
||||
import DataFlow::PathGraph
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
import csharp
|
||||
import semmle.code.asp.WebConfig
|
||||
import semmle.code.csharp.XML
|
||||
|
||||
class Application_Error extends Method {
|
||||
Application_Error() {
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
|
||||
private import csharp
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import semmle.code.csharp.dataflow.DataFlow
|
||||
private import semmle.code.csharp.dataflow.ExternalFlow
|
||||
private import semmle.code.csharp.dataflow.FlowSummary
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowDispatch as DataFlowDispatch
|
||||
private import semmle.code.csharp.dataflow.TaintTracking
|
||||
private import semmle.code.csharp.dataflow.internal.TaintTrackingPrivate
|
||||
private import semmle.code.csharp.security.dataflow.flowsources.Remote
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.DataFlow2
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
import semmle.code.csharp.dataflow.TaintTracking2
|
||||
import DataFlow::PathGraph
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ private import TranslatedExpr
|
||||
private import TranslatedStmt
|
||||
private import desugar.Foreach
|
||||
private import TranslatedFunction
|
||||
private import experimental.ir.Util
|
||||
private import experimental.ir.internal.IRCSharpLanguage as Language
|
||||
|
||||
TranslatedElement getInstructionTranslatedElement(Instruction instruction) {
|
||||
|
||||
@@ -5,7 +5,6 @@ private import InstructionTag
|
||||
private import TranslatedElement
|
||||
private import TranslatedExpr
|
||||
private import TranslatedInitialization
|
||||
private import experimental.ir.Util
|
||||
private import experimental.ir.implementation.raw.internal.common.TranslatedCallBase
|
||||
private import experimental.ir.internal.IRCSharpLanguage as Language
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ private import TranslatedCondition
|
||||
private import TranslatedFunction
|
||||
private import TranslatedStmt
|
||||
private import IRConstruction
|
||||
private import experimental.ir.Util
|
||||
private import experimental.ir.internal.IRCSharpLanguage as Language
|
||||
private import desugar.Foreach
|
||||
private import desugar.Delegate
|
||||
|
||||
@@ -16,7 +16,6 @@ private import common.TranslatedExprBase
|
||||
private import desugar.Delegate
|
||||
private import desugar.internal.TranslatedCompilerGeneratedCall
|
||||
import TranslatedCall
|
||||
private import experimental.ir.Util
|
||||
private import experimental.ir.internal.IRCSharpLanguage as Language
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ private import InstructionTag
|
||||
private import TranslatedElement
|
||||
private import TranslatedExpr
|
||||
private import TranslatedFunction
|
||||
private import experimental.ir.Util
|
||||
private import IRInternal
|
||||
private import desugar.Delegate
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ private import experimental.ir.implementation.internal.OperandTag
|
||||
private import experimental.ir.implementation.raw.internal.InstructionTag
|
||||
private import experimental.ir.implementation.raw.internal.TranslatedElement
|
||||
private import experimental.ir.implementation.raw.internal.TranslatedExpr
|
||||
private import experimental.ir.Util
|
||||
private import experimental.ir.internal.CSharpType
|
||||
private import experimental.ir.internal.IRCSharpLanguage as Language
|
||||
private import TranslatedExprBase
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.Comments
|
||||
|
||||
/**
|
||||
* A class representing line comments in C# used by the InlineExpectations core code
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
// Test that all the copies of the taint tracking library can be imported
|
||||
// simultaneously without errors.
|
||||
import semmle.code.csharp.dataflow.TaintTracking2
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import semmle.code.csharp.commons.Disposal
|
||||
import csharp
|
||||
|
||||
from Variable v
|
||||
where
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
|
||||
from DataFlow::Node pred, DataFlow::Node succ
|
||||
where
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
|
||||
from StringLiteral l, DataFlow::Node n
|
||||
where TaintTracking::localTaintStep+(DataFlow::exprNode(l), n)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
|
||||
class Configuration extends TaintTracking::Configuration {
|
||||
Configuration() { this = "Json.NET test" }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.dataflow.TaintTracking
|
||||
|
||||
class MyConfiguration extends TaintTracking::Configuration {
|
||||
MyConfiguration() { this = "MyConfiguration" }
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import javascript
|
||||
private import semmle.javascript.heuristics.SyntacticHeuristics
|
||||
private import semmle.javascript.security.dataflow.NosqlInjectionCustomizations
|
||||
private import semmle.javascript.security.TaintedObject
|
||||
import AdaptiveThreatModeling
|
||||
private import CoreKnowledge as CoreKnowledge
|
||||
private import StandardEndpointFilters as StandardEndpointFilters
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import javascript
|
||||
import DOMProperties
|
||||
import semmle.javascript.frameworks.xUnit
|
||||
|
||||
/**
|
||||
* Holds if `e` appears in a syntactic context where its value is discarded.
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.Promises
|
||||
|
||||
/** Provices classes for modelling NoSQL query sinks. */
|
||||
module NoSql {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.Promises
|
||||
|
||||
module SQL {
|
||||
/** A string-valued expression that is interpreted as a SQL command. */
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.frameworks.xUnit
|
||||
import semmle.javascript.frameworks.TestingCustomizations
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
import javascript
|
||||
private import semmle.javascript.security.SensitiveActions
|
||||
private import semmle.javascript.frameworks.CryptoLibraries
|
||||
|
||||
module BrokenCryptoAlgorithm {
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** DEPRECATED. Import `ClientSideUrlRedirectQuery` instead. */
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
import UrlConcatenation
|
||||
private import ClientSideUrlRedirectQuery as ClientSideUrlRedirectQuery // ignore-query-import
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
module ClientSideUrlRedirect {
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
import UrlConcatenation
|
||||
import ClientSideUrlRedirectCustomizations::ClientSideUrlRedirect
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
module CommandInjection {
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** DEPRECATED. Import `DifferentKindsComparisonBypassQuery` instead. */
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
private import DifferentKindsComparisonBypassQuery as DifferentKindsComparisonBypassQuery // ignore-query-import
|
||||
|
||||
/** DEPRECATED. Import `DifferentKindsComparisonBypassQuery` instead. */
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
module DifferentKindsComparisonBypass {
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
import DifferentKindsComparisonBypassCustomizations::DifferentKindsComparisonBypass
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
module FileAccessToHttp {
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
private import HttpToFileAccessCustomizations::HttpToFileAccess
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
import semmle.javascript.security.IncompleteBlacklistSanitizer
|
||||
|
||||
module IncompleteHtmlAttributeSanitization {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
module IndirectCommandInjection {
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
import javascript
|
||||
private import semmle.javascript.security.SensitiveActions
|
||||
private import semmle.javascript.frameworks.CryptoLibraries
|
||||
|
||||
module InsufficientPasswordHash {
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
private import semmle.javascript.dataflow.InferredTypes
|
||||
|
||||
module TypeConfusionThroughParameterTampering {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** DEPRECATED. Import `UnsafeDeserializationQuery` instead. */
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
private import UnsafeDeserializationQuery as UnsafeDeserializationQuery // ignore-query-import
|
||||
|
||||
/** DEPRECATED. Import `UnsafeDeserializationQuery` instead. */
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
module UnsafeDeserialization {
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
import UnsafeDeserializationCustomizations::UnsafeDeserialization
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import javascript
|
||||
private import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
private import semmle.javascript.PackageExports as Exports
|
||||
private import semmle.javascript.dataflow.InferredTypes
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.PrototypePollutionQuery
|
||||
import DataFlow::PathGraph
|
||||
import semmle.javascript.dependencies.Dependencies
|
||||
|
||||
from
|
||||
Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, string moduleName,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import javascript
|
||||
import semmle.javascript.frameworks.CryptoLibraries
|
||||
|
||||
from CryptographicKey key
|
||||
select key
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import javascript
|
||||
import semmle.javascript.frameworks.CryptoLibraries
|
||||
|
||||
from CryptographicOperation operation
|
||||
select operation, operation.getAlgorithm().getName(), operation.getInput()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.RemoteFlowSources
|
||||
|
||||
class ExampleConfiguration extends TaintTracking::Configuration {
|
||||
ExampleConfiguration() { this = "ExampleConfiguration" }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
private import semmle.python.objects.ObjectAPI
|
||||
private import semmle.python.objects.Modules
|
||||
private import semmle.python.internal.CachedStages
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import semmle.python.pointsto.Base
|
||||
private import semmle.python.pointsto.PointsTo
|
||||
private import semmle.python.pointsto.PointsToContext
|
||||
private import semmle.python.objects.ObjectInternal
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import semmle.python.pointsto.Base
|
||||
private import semmle.python.internal.CachedStages
|
||||
|
||||
cached
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
private import python
|
||||
private import semmle.python.Concepts
|
||||
private import semmle.python.ApiGraphs
|
||||
private import semmle.python.dataflow.new.DataFlow
|
||||
private import semmle.python.dataflow.new.TaintTracking
|
||||
private import semmle.python.frameworks.internal.InstanceTaintStepsHelper
|
||||
private import semmle.python.frameworks.Stdlib
|
||||
|
||||
@@ -136,6 +136,7 @@ class PackageObjectInternal extends ModuleObjectInternal, TPackageObject {
|
||||
/** Gets the init module of this package */
|
||||
PythonModuleObjectInternal getInitModule() { result = TPythonModule(this.getSourceModule()) }
|
||||
|
||||
/** Holds if the folder for this package has no init module. */
|
||||
predicate hasNoInitModule() {
|
||||
exists(Folder f |
|
||||
f = this.getFolder() and
|
||||
|
||||
@@ -3,7 +3,6 @@ import semmle.python.types.Exceptions
|
||||
private import semmle.python.pointsto.PointsTo
|
||||
private import semmle.python.objects.Callables
|
||||
private import semmle.python.libraries.Zope
|
||||
private import semmle.python.pointsto.Base
|
||||
private import semmle.python.objects.ObjectInternal
|
||||
private import semmle.python.types.Builtins
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
private import semmle.python.objects.ObjectAPI
|
||||
private import semmle.python.objects.ObjectInternal
|
||||
private import semmle.python.types.Builtins
|
||||
private import semmle.python.internal.CachedStages
|
||||
|
||||
@@ -2,7 +2,6 @@ import python
|
||||
import semmle.python.dataflow.TaintTracking
|
||||
import semmle.python.web.Http
|
||||
import semmle.python.web.falcon.General
|
||||
import semmle.python.security.strings.External
|
||||
|
||||
/** https://falcon.readthedocs.io/en/stable/api/request_and_response.html */
|
||||
deprecated class FalconRequest extends TaintKind {
|
||||
|
||||
@@ -2,7 +2,6 @@ import python
|
||||
import semmle.python.dataflow.TaintTracking
|
||||
import semmle.python.web.Http
|
||||
import semmle.python.web.falcon.General
|
||||
import semmle.python.security.strings.External
|
||||
|
||||
/** https://falcon.readthedocs.io/en/stable/api/request_and_response.html */
|
||||
deprecated class FalconResponse extends TaintKind {
|
||||
|
||||
@@ -3,7 +3,6 @@ import semmle.python.dataflow.TaintTracking
|
||||
import semmle.python.security.strings.Basic
|
||||
import semmle.python.web.Http
|
||||
private import semmle.python.web.pyramid.View
|
||||
private import semmle.python.web.Http
|
||||
|
||||
/**
|
||||
* A pyramid response, which is vulnerable to any sort of
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
import semmle.python.SelfAttribute
|
||||
import Equality
|
||||
|
||||
predicate class_stores_to_attribute(ClassValue cls, SelfAttributeStore store, string name) {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
import semmle.python.SelfAttribute
|
||||
import ClassAttributes
|
||||
|
||||
predicate guarded_by_other_attribute(SelfAttributeRead a, CheckClass c) {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
import semmle.python.SelfAttribute
|
||||
import ClassAttributes
|
||||
|
||||
predicate undefined_class_attribute(SelfAttributeRead a, CheckClass c, int line, string name) {
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* @id py/str-format/surplus-argument
|
||||
*/
|
||||
|
||||
import python
|
||||
import python
|
||||
import AdvancedFormatting
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import Lexical.CommentedOutCode
|
||||
import python
|
||||
|
||||
from File f, int n
|
||||
where n = count(CommentedOutCodeLine c | not c.maybeExampleCode() and c.getLocation().getFile() = f)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Contains predicates concerning when and where files are opened and closed. */
|
||||
|
||||
import python
|
||||
import semmle.python.GuardedControlFlow
|
||||
import semmle.python.pointsto.Filters
|
||||
|
||||
/** Holds if `open` is a call that returns a newly opened file */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
private import python
|
||||
private import semmle.python.Concepts
|
||||
private import semmle.python.ApiGraphs
|
||||
private import semmle.python.dataflow.new.DataFlow
|
||||
private import semmle.python.dataflow.new.RemoteFlowSources
|
||||
private import semmle.python.dataflow.new.DataFlow
|
||||
|
||||
/**
|
||||
* A data flow source of the client ip obtained according to the remote endpoint identifier specified
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import semmle.python.objects.ObjectAPI
|
||||
|
||||
from int line, ControlFlowNode f, Value v
|
||||
where
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import python
|
||||
import semmle.python.pointsto.PointsTo
|
||||
import semmle.python.pointsto.PointsToContext
|
||||
import semmle.python.objects.ObjectInternal
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import semmle.python.pointsto.Base
|
||||
|
||||
from ClassObject cls, string name
|
||||
where class_declares_attribute(cls, name)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import semmle.python.types.Descriptors
|
||||
import Util
|
||||
|
||||
from ClassMethodObject cm, CallNode call
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import python
|
||||
import Util
|
||||
import semmle.python.pointsto.PointsTo
|
||||
import semmle.python.objects.ObjectInternal
|
||||
|
||||
/* This test should return _no_ results. */
|
||||
predicate relevant_node(ControlFlowNode n) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import python
|
||||
import Util
|
||||
import semmle.python.pointsto.PointsTo
|
||||
import semmle.python.objects.ObjectInternal
|
||||
|
||||
from ControlFlowNode f, ControlFlowNode x
|
||||
where PointsTo::pointsTo(f, _, ObjectInternal::unknown(), x)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import semmle.python.SelfAttribute
|
||||
|
||||
from SelfAttributeRead sa, int line, string g, string l
|
||||
where
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import semmle.python.types.Descriptors
|
||||
|
||||
int lineof(Object o) { result = o.getOrigin().getLocation().getStartLine() }
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import python
|
||||
import semmle.python.types.Descriptors
|
||||
|
||||
from PropertyValue p, string method_name, FunctionValue method
|
||||
where
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WARNING: Type CommandSink has been deprecated and may be removed in future (CommandSinks.ql:5,6-17)
|
||||
WARNING: Type CommandSink has been deprecated and may be removed in future (CommandSinks.ql:4,6-17)
|
||||
| fabric_v1_test.py:8:7:8:28 | FabricV1Commands | externally controlled string |
|
||||
| fabric_v1_test.py:9:5:9:27 | FabricV1Commands | externally controlled string |
|
||||
| fabric_v1_test.py:10:6:10:38 | FabricV1Commands | externally controlled string |
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import python
|
||||
import semmle.python.security.injection.Command
|
||||
import semmle.python.security.strings.Untrusted
|
||||
|
||||
from CommandSink sink, TaintKind kind
|
||||
where sink.sinks(kind)
|
||||
|
||||
@@ -2,7 +2,6 @@ import python
|
||||
import semmle.python.security.injection.Sql
|
||||
import semmle.python.web.django.Db
|
||||
import semmle.python.web.django.Model
|
||||
import semmle.python.security.strings.Untrusted
|
||||
|
||||
from SqlInjectionSink sink, TaintKind kind
|
||||
where sink.sinks(kind)
|
||||
|
||||
67
ql/ql/src/codeql_ql/style/RedundantImportQuery.qll
Normal file
67
ql/ql/src/codeql_ql/style/RedundantImportQuery.qll
Normal file
@@ -0,0 +1,67 @@
|
||||
import ql
|
||||
|
||||
Import imports(Import imp) {
|
||||
(
|
||||
exists(File file, TopLevel top |
|
||||
imp.getResolvedModule().asFile() = file and
|
||||
top.getLocation().getFile() = file and
|
||||
result = top.getAMember()
|
||||
)
|
||||
or
|
||||
exists(Module mod |
|
||||
imp.getResolvedModule().asModule() = mod and
|
||||
result = mod.getAMember()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Import getAnImport(AstNode parent) {
|
||||
result = parent.(TopLevel).getAMember()
|
||||
or
|
||||
result = parent.(Module).getAMember()
|
||||
}
|
||||
|
||||
pragma[inline]
|
||||
predicate importsFromSameFolder(Import a, Import b) {
|
||||
exists(string base |
|
||||
a.getImportString().regexpCapture("(.*)\\.[^\\.]*", 1) = base and
|
||||
b.getImportString().regexpCapture("(.*)\\.[^\\.]*", 1) = base
|
||||
)
|
||||
or
|
||||
not a.getImportString().matches("%.%") and
|
||||
not b.getImportString().matches("%.%")
|
||||
}
|
||||
|
||||
predicate problem(Import imp, Import redundant, string message) {
|
||||
not exists(imp.importedAs()) and
|
||||
not exists(redundant.importedAs()) and
|
||||
// skip the top-level language files, they have redundant imports, and that's fine.
|
||||
not exists(imp.getLocation().getFile().getParentContainer().getFile("qlpack.yml")) and
|
||||
// skip the DataFlowImpl.qll and similar, they have redundant imports in some copies.
|
||||
not imp.getLocation()
|
||||
.getFile()
|
||||
.getBaseName()
|
||||
.regexpMatch([".*Impl\\d?\\.qll", "DataFlowImpl.*\\.qll"]) and
|
||||
// skip two imports that imports different things from the same folder.
|
||||
not importsFromSameFolder(imp, redundant) and
|
||||
// if the redundant is public, and the imp is private, then the redundant might add things that are exported.
|
||||
not (imp.isPrivate() and not redundant.isPrivate()) and
|
||||
// Actually checking if the import is redundant:
|
||||
exists(AstNode parent |
|
||||
imp = getAnImport(parent) and
|
||||
redundant = getAnImport(parent) and
|
||||
redundant.getLocation().getStartLine() > imp.getLocation().getStartLine()
|
||||
|
|
||||
message = "Redundant import, the module is already imported inside $@." and
|
||||
// only looking for things directly imported one level down. Otherwise things gets complicated (lots of cycles).
|
||||
exists(Import inner | inner = imports(imp) |
|
||||
redundant.getResolvedModule() = inner.getResolvedModule() and
|
||||
not inner.isPrivate() and // if the inner is private, then it's not propagated out.
|
||||
not exists(inner.importedAs())
|
||||
)
|
||||
or
|
||||
message = "Duplicate import, the module is already imported by $@." and
|
||||
// two different import statements, that import the same thing
|
||||
imp.getResolvedModule() = redundant.getResolvedModule()
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
import ql
|
||||
import Definitions
|
||||
import codeql.IDEContextual
|
||||
|
||||
external string selectedSourceFile();
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
import ql
|
||||
import Definitions
|
||||
import codeql.IDEContextual
|
||||
|
||||
external string selectedSourceFile();
|
||||
|
||||
|
||||
17
ql/ql/src/queries/style/RedundantImport.ql
Normal file
17
ql/ql/src/queries/style/RedundantImport.ql
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @name Redundant import
|
||||
* @description An import that is redundant due to an earlier import
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id ql/redundant-import
|
||||
* @tags correctness
|
||||
* performance
|
||||
* @precision high
|
||||
*/
|
||||
|
||||
import ql
|
||||
import codeql_ql.style.RedundantImportQuery
|
||||
|
||||
from Import imp, Import redundant, string message
|
||||
where problem(imp, redundant, message)
|
||||
select redundant, message, imp, imp.getImportString()
|
||||
@@ -1,6 +1,5 @@
|
||||
private import codeql.ruby.AST
|
||||
private import codeql.ruby.CFG
|
||||
private import codeql.ruby.ast.Constant
|
||||
private import internal.AST
|
||||
private import internal.Constant
|
||||
private import internal.Expr
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user