mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: Remove dependence on Builtins from attribute module
The `Builtins` module is deeply entwined with points-to, so it would be nice to not have this dependence. Happily, the only thing we used `Builtin` for was to get the names of known builtins, and for this we already maintain such a set of names in `dataflow.new.internal.Builtins`.
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
/** This module provides an API for attribute reads and writes. */
|
/** This module provides an API for attribute reads and writes. */
|
||||||
|
|
||||||
|
private import python
|
||||||
import DataFlowUtil
|
import DataFlowUtil
|
||||||
import DataFlowPublic
|
import DataFlowPublic
|
||||||
private import DataFlowPrivate
|
private import DataFlowPrivate
|
||||||
private import semmle.python.types.Builtins
|
private import semmle.python.dataflow.new.internal.Builtins
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A data flow node that reads or writes an attribute of an object.
|
* A data flow node that reads or writes an attribute of an object.
|
||||||
@@ -134,8 +135,12 @@ private class BuiltInCallNode extends CallNode {
|
|||||||
|
|
||||||
BuiltInCallNode() {
|
BuiltInCallNode() {
|
||||||
// TODO disallow instances where the name of the built-in may refer to an in-scope variable of that name.
|
// TODO disallow instances where the name of the built-in may refer to an in-scope variable of that name.
|
||||||
exists(NameNode id | this.getFunction() = id and id.getId() = name and id.isGlobal()) and
|
exists(NameNode id |
|
||||||
name = any(Builtin b).getName()
|
name = Builtins::getBuiltinName() and
|
||||||
|
this.getFunction() = id and
|
||||||
|
id.getId() = name and
|
||||||
|
id.isGlobal()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the name of the built-in function that is called at this `CallNode` */
|
/** Gets the name of the built-in function that is called at this `CallNode` */
|
||||||
|
|||||||
Reference in New Issue
Block a user