Skip to content

Commit 329ff0d

Browse files
committed
JS: Add an use getAPropertySource()
1 parent 5ce08e2 commit 329ff0d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

javascript/ql/src/semmle/javascript/dataflow/Nodes.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,10 +879,10 @@ module ClassNode {
879879

880880
override FunctionNode getAnInstanceMember(MemberKind kind) {
881881
kind = MemberKind::method() and
882-
result = getAPrototypeReference().getAPropertyWrite().getRhs().getALocalSource()
882+
result = getAPrototypeReference().getAPropertySource()
883883
or
884884
kind = MemberKind::method() and
885-
result = getConstructor().getReceiver().getAPropertyWrite().getRhs().getALocalSource()
885+
result = getConstructor().getReceiver().getAPropertySource()
886886
or
887887
exists(PropertyAccessor accessor |
888888
accessor = getAnAccessor(kind) and
@@ -893,7 +893,7 @@ module ClassNode {
893893
override FunctionNode getStaticMethod(string name) { result = getAPropertySource(name) }
894894

895895
override FunctionNode getAStaticMethod() {
896-
result = getAPropertyWrite().getRhs().getALocalSource()
896+
result = getAPropertySource()
897897
}
898898

899899
/**

javascript/ql/src/semmle/javascript/dataflow/Sources.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ class SourceNode extends DataFlow::Node {
155155
result.flowsTo(getAPropertyWrite(prop).getRhs())
156156
}
157157

158+
/**
159+
* Gets a source node whose value is stored in a property of this node.
160+
*/
161+
DataFlow::SourceNode getAPropertySource() {
162+
result.flowsTo(getAPropertyWrite().getRhs())
163+
}
164+
158165
/**
159166
* EXPERIMENTAL.
160167
*

0 commit comments

Comments
 (0)