Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions powershell/ql/lib/semmle/code/powershell/ApiGraphs.qll
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ module API {
result = this.getContent(contents.getAReadContent())
}

/**
* Gets a representative for the instanceof field of the given `name`.
*/
pragma[inline]
Node getField(string name) {
// This predicate is currently not 'inline_late' because 'name' can be an input or output
Impl::fieldEdge(this.getAnEpsilonSuccessor(), name, result)
}

/**
* Gets a representative for an arbitrary element of this collection.
*/
Expand Down Expand Up @@ -615,6 +624,15 @@ module API {
contentEdge(pred, any(DataFlow::ContentSet set | set.isAnyElement()).getAReadContent(), succ)
}

cached
predicate fieldEdge(Node pred, string name, Node succ) {
exists(DataFlow::ContentSet set, DataFlow::Content::FieldContent fc |
fc.getLowerCaseName() = name and
set.isSingleton(fc) and
contentEdge(pred, set.getAReadContent(), succ)
)
}

cached
predicate parameterEdge(Node pred, DataFlowDispatch::ParameterPosition paramPos, Node succ) {
exists(DataFlowPrivate::ParameterNodeImpl parameter, DataFlow::CallableNode callable |
Expand Down