JS: rename CapturedSource -> LocalObject

This commit is contained in:
Esben Sparre Andreasen
2019-02-25 16:04:37 +01:00
parent 65fb1423b7
commit 66367987af
5 changed files with 10 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ import UnusedVariable
import UnusedParameter
import Expressions.ExprHasNoEffect
predicate hasUnknownPropertyRead(CapturedSource obj) {
predicate hasUnknownPropertyRead(LocalObject obj) {
// dynamic reads
exists(DataFlow::PropRead r | obj.getAPropertyRead() = r | not exists(r.getPropertyName()))
or
@@ -33,7 +33,7 @@ predicate hasUnknownPropertyRead(CapturedSource obj) {
/**
* Holds if `obj` flows to an expression that must have a specific type.
*/
predicate flowsToTypeRestrictedExpression(CapturedSource obj) {
predicate flowsToTypeRestrictedExpression(LocalObject obj) {
exists (Expr restricted, TypeExpr type |
obj.flowsToExpr(restricted) and
not type.isAny() |
@@ -50,7 +50,7 @@ predicate flowsToTypeRestrictedExpression(CapturedSource obj) {
)
}
from DataFlow::PropWrite write, CapturedSource obj, string name
from DataFlow::PropWrite write, LocalObject obj, string name
where
write = obj.getAPropertyWrite(name) and
not exists(obj.getAPropertyRead(name)) and

View File

@@ -54,11 +54,11 @@ private predicate exposedAsReceiver(DataFlow::SourceNode n) {
}
/**
* A source for which the flow is entirely captured by the dataflow library.
* A source that is entirely local, i.e. the dataflow library models all of its flow.
* All uses of the node are modeled by `this.flowsTo(_)` and related predicates.
*/
class CapturedSource extends DataFlow::SourceNode {
CapturedSource() {
class LocalObject extends DataFlow::SourceNode {
LocalObject() {
// pragmatic limitation: object literals only
this instanceof DataFlow::ObjectLiteralNode and
not flowsTo(getAnEscape()) and

View File

@@ -238,7 +238,7 @@ private class TypeInferredCalleeWithAnalyzedReturnFlow extends CallWithNonLocalA
*/
pragma[noinline]
private predicate hasDefiniteReceiver(
DataFlow::MethodCallNode call, CapturedSource receiver
DataFlow::MethodCallNode call, LocalObject receiver
) {
call = receiver.getAMethodCall() and
exists (DataFlow::AnalyzedNode receiverNode, AbstractValue abstractCapturedReceiver |
@@ -260,7 +260,7 @@ private class TypeInferredMethodWithAnalyzedReturnFlow extends CallWithNonLocalA
DataFlow::FunctionNode fun;
TypeInferredMethodWithAnalyzedReturnFlow() {
exists(CapturedSource obj, DataFlow::PropWrite write, string name |
exists(LocalObject obj, DataFlow::PropWrite write, string name |
this.(DataFlow::MethodCallNode).getMethodName() = name and
obj.hasOwnProperty(name) and
hasDefiniteReceiver(this, obj) and

View File

@@ -1,4 +1,4 @@
import javascript
import semmle.javascript.dataflow.CapturedNodes
select any(CapturedSource n)
select any(LocalObject n)

View File

@@ -1,6 +1,6 @@
import javascript
import semmle.javascript.dataflow.CapturedNodes
from CapturedSource src, string name
from LocalObject src, string name
where src.hasOwnProperty(name)
select src, name