Merge pull request #20739 from github/tausbn/python-remove-top-level-points-to-imports

Python: Hide points-to imports in `python.qll`
This commit is contained in:
Taus
2025-12-05 14:24:41 +01:00
committed by GitHub
284 changed files with 690 additions and 430 deletions

View File

@@ -1,5 +1,6 @@
import python
private import LegacyPointsTo
from Module m, int n
where n = m.getMetrics().getNumberOfLinesOfComments()
from ModuleMetrics m, int n
where n = m.getNumberOfLinesOfComments()
select m.toString(), n

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from Function func
select func.toString(), func.getMetrics().getCyclomaticComplexity()
from FunctionMetrics func
select func.toString(), func.getCyclomaticComplexity()

View File

@@ -1,8 +1,9 @@
import python
private import LegacyPointsTo
from Scope s, int n
where
exists(Function f | f = s | n = f.getMetrics().getNumberOfLines())
exists(FunctionMetrics f | f = s | n = f.getNumberOfLines())
or
exists(Module m | m = s | n = m.getMetrics().getNumberOfLines())
exists(ModuleMetrics m | m = s | n = m.getNumberOfLines())
select s.toString(), n

View File

@@ -1,5 +1,6 @@
import python
private import LegacyPointsTo
from SsaVariable var
from SsaVariableWithPointsTo var
where var.maybeUndefined()
select var.getDefinition().getLocation().getStartLine(), var.toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassValue cls, string description
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from string txt, Value val
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from FunctionValue v, string name
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from Value val, string name
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ControlFlowNode call, Value func
where call = func.getACall()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from CallNode call, CallableValue callable, int i
select call.getLocation().getStartLine(), call.toString(), callable.toString(), i,

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from CallNode call, CallableValue callable, string name
select call.getLocation().getStartLine(), call.toString(), callable.toString(), name,

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from CallableValue callable, int i
select callable.toString(), i, callable.getParameter(i).toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from CallableValue callable, string name
select callable.toString(), name, callable.getParameterByName(name).toString()

View File

@@ -1,6 +1,5 @@
import python
import semmle.python.pointsto.PointsTo
import semmle.python.objects.ObjectInternal
private import LegacyPointsTo
from NameNode f, Context ctx, ObjectInternal v
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from CallNode call, FunctionObject func, string kind
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from FunctionObject f
where f.neverReturns()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from Call c, FunctionObject f
where

View File

@@ -1,5 +1,6 @@
import python
private import LegacyPointsTo
private import semmle.python.types.ImportTime
import interesting
from int line, ControlFlowNodeWithPointsTo f, Object o, ImportTimeScope n

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
string repr(Object o) {
not o instanceof StringObject and not o = theBoundMethodType() and result = o.toString()

View File

@@ -1,7 +1,5 @@
import python
import semmle.python.pointsto.PointsTo
import semmle.python.pointsto.PointsToContext
import semmle.python.objects.ObjectInternal
private import LegacyPointsTo
from ControlFlowNode f, PointsToContext ctx, Value obj, ControlFlowNode orig
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, ClassObject base, int n
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from Call c, FunctionObject f
where f.getACall().getNode() = c

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string name
where class_declares_attribute(cls, name)

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, ClassObject meta
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, ClassObject sup
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string reason
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string style
where

View File

@@ -1,5 +1,5 @@
import python
private import semmle.python.objects.ObjectInternal
private import LegacyPointsTo
/** An unknown type. Not usually visible. */
class UnknownType extends UnknownClassInternal {

View File

@@ -1,5 +1,6 @@
import python
import Util
private import LegacyPointsTo
from ControlFlowNode call, FunctionObject func
where call = func.getACall()

View File

@@ -1,5 +1,6 @@
import python
import Util
private import LegacyPointsTo
from ClassMethodObject cm, CallNode call
where call = cm.getACall()

View File

@@ -1,5 +1,6 @@
import python
import Util
private import LegacyPointsTo
from Scope s, string name, Object val
where

View File

@@ -1,6 +1,6 @@
import python
import Util
import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
/* This test should return _no_ results. */
predicate relevant_node(ControlFlowNode n) {

View File

@@ -1,6 +1,6 @@
import python
import Util
import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
from ControlFlowNode f, ControlFlowNode x
where PointsTo::pointsTo(f, _, ObjectInternal::unknown(), x)

View File

@@ -1,7 +1,6 @@
import python
import Util
import semmle.python.pointsto.PointsTo
import semmle.python.pointsto.PointsToContext
private import LegacyPointsTo
from ControlFlowNode f, Object o, ClassObject c, ControlFlowNode x, PointsToContext ctx
where PointsTo::points_to(f, ctx, o, c, x)

View File

@@ -1,6 +1,6 @@
import python
import Util
import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
from ControlFlowNode f, Object o, ClassObject c, ControlFlowNode x
where PointsTo::points_to(f, _, o, c, x)

View File

@@ -1,5 +1,5 @@
import python
private import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
import Util
from ControlFlowNode f, Context ctx

View File

@@ -1,6 +1,5 @@
import python
private import semmle.python.pointsto.PointsTo
private import semmle.python.pointsto.PointsToContext
private import LegacyPointsTo
import Util
predicate ssa_variable_points_to(

View File

@@ -1,5 +1,4 @@
import python
import semmle.python.pointsto.PointsTo
import Util
from SsaSourceVariable var, ControlFlowNode use, BasicBlock pred

View File

@@ -1,5 +1,4 @@
import python
import semmle.python.pointsto.PointsTo
import Util
from SsaSourceVariable var, ControlFlowNode defn, string kind

View File

@@ -1,6 +1,5 @@
import python
private import semmle.python.pointsto.PointsTo
private import semmle.python.objects.ObjectInternal
private import LegacyPointsTo
import Util
from EssaVariable var, string name, ObjectInternal o, Context ctx

View File

@@ -1,5 +1,4 @@
import python
import semmle.python.pointsto.PointsTo
import Util
from EssaVariable var, ControlFlowNode use

View File

@@ -1,6 +1,5 @@
import python
import semmle.python.pointsto.PointsTo
import semmle.python.pointsto.PointsToContext
private import LegacyPointsTo
import Util
from

View File

@@ -1,5 +1,5 @@
import python
import semmle.python.objects.ObjectInternal
private import LegacyPointsTo
bindingset[which]
string locate(Location l, string which) {

View File

@@ -1,5 +1,5 @@
import python
import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
import Util
from SsaSourceVariable var, ControlFlowNode use

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PythonFunctionValue func
select func, func.getACall()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ModuleValue mv, ControlFlowNode ref, string local_external
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ModuleValue mv, ControlFlowNode ref, string in_stdlib, string local_external, string is_missing
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PyFunctionObject f
select f.toString(), f.getAnInferredReturnType().toString()

View File

@@ -1,5 +1,5 @@
import python
import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
from Value sup, Value cls
where Expressions::requireSubClass(cls, sup)

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from SelfAttributeRead sa, int line, string g, string l
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string abstract
where

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, int line, string name, Object obj
where

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, int line, string name, Object obj
where

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, int line, string name
where

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, int line, string name
where

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, int line, Object obj
where

View File

@@ -1,5 +1,6 @@
import python
import semmle.python.pointsto.MRO
private import LegacyPointsTo
from ClassValue cls
where not cls.isBuiltin()

View File

@@ -1,5 +1,6 @@
import python
import semmle.python.dependencies.Dependencies
private import LegacyPointsTo
from DependencyKind dk, AstNode src, Object target
where dk.isADependency(src, target)

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string kind
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
int lineof(Object o) { result = o.getOrigin().getLocation().getStartLine() }

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PropertyValue p, string method_name, FunctionValue method
where

View File

@@ -1,5 +1,6 @@
import python
private import LegacyPointsTo
from ExceptFlowNode ex, Value val
from ExceptFlowNodeWithPointsTo ex, Value val
where ex.handledException(val, _, _)
select ex.getLocation().getStartLine(), ex.toString(), val.toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string legal
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from string name, int mcnt
where mcnt = strictcount(Module m | m.getName() = name) and mcnt > 1

View File

@@ -1,5 +1,6 @@
/* Test that there are no literals that do not have a corresponding object. */
import python
private import LegacyPointsTo
string repr(Expr e) {
result = e.(Num).getN() or
@@ -8,5 +9,5 @@ string repr(Expr e) {
}
from ImmutableLiteral l
where not exists(l.getLiteralObject())
where not exists(getLiteralObject(l))
select l.getLocation().getStartLine(), repr(l)

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from Object o, string name
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PythonFunctionValue f, string overriding, string overridden
where

View File

@@ -1,5 +1,6 @@
import python
import Lib
private import LegacyPointsTo
from ControlFlowNode f, TrackableState state, Context ctx, boolean sense
where

View File

@@ -1,5 +1,6 @@
import python
import semmle.python.dataflow.TaintTracking
private import LegacyPointsTo
class SimpleTest extends TaintKind {
SimpleTest() { this = "simple.test" }

View File

@@ -2,6 +2,7 @@ import python
import semmle.python.dataflow.TaintTracking
import TaintLib
import semmle.python.dataflow.Implementation
private import LegacyPointsTo
from
TaintTrackingImplementation config, TaintTrackingNode src, CallNode call,

View File

@@ -1,6 +1,7 @@
import python
import semmle.python.dataflow.Implementation
import TaintLib
private import LegacyPointsTo
from ModuleValue m, string name, TaintedNode origin, TaintTrackingImplementation impl
where impl.moduleAttributeTainted(m, name, origin)

View File

@@ -1,5 +1,6 @@
import python
import semmle.python.dataflow.TaintTracking
private import LegacyPointsTo
class SimpleTest extends TaintKind {
SimpleTest() { this = "simple.test" }

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, ClassObject start, string name, Object val
where not name.substring(0, 2) = "__" and val = cls.lookupMro(start, name)

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, string name, string kind
where

View File

@@ -5,6 +5,7 @@
*/
import python
private import LegacyPointsTo
from ClassObject cls, string name, string kind, Object o
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls, string name, string kind, Object o
where

View File

@@ -1,5 +1,5 @@
import python
import semmle.python.pointsto.PointsTo
private import LegacyPointsTo
from ClassValue cls, string reason
where Types::failedInference(cls, reason)

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ClassObject cls
where cls.hasDuplicateBases()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from RaisingNode r, Scope s, ClassObject cls
where r.viableExceptionalExit_objectapi(s, cls)

View File

@@ -1,5 +1,6 @@
import python
private import LegacyPointsTo
from ExceptFlowNode n, ClassObject cls
from ExceptFlowNodeWithPointsTo n, ClassObject cls
where n.handles_objectapi(cls)
select n.getLocation().getStartLine(), cls.toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from RaisingNode r, ControlFlowNode n, string kind
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from RaisingNode r, string type
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PyFunctionObject f, string type
where

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from ReraisingNode r
select r.getLocation().getStartLine(), r, r.getARaisedType().toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from RaisingNode r, ControlFlowNode n, ClassObject ex
where r.viableExceptionEdge_objectapi(n, ex)

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PythonPropertyObject p
select p.toString(), p.getDeleter().toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PythonPropertyObject p
select p.toString(), p.getGetter().toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PythonPropertyObject p
select p.toString()

View File

@@ -1,4 +1,5 @@
import python
private import LegacyPointsTo
from PythonPropertyObject p
select p.toString(), p.getSetter().toString()