mirror of
https://github.com/github/codeql.git
synced 2026-03-17 04:56:58 +01:00
27 lines
933 B
Plaintext
27 lines
933 B
Plaintext
/**
|
|
* Provides classes and predicates modeling the Tanstack/react-query library.
|
|
*/
|
|
|
|
private import javascript
|
|
|
|
/**
|
|
* An additional flow step that propagates data from the return value of the query function,
|
|
* defined in a useQuery call from the '@tanstack/react-query' module, to the 'data' property.
|
|
*/
|
|
private class TanstackStep extends DataFlow::AdditionalFlowStep {
|
|
override predicate step(DataFlow::Node node1, DataFlow::Node node2) {
|
|
exists(API::CallNode useQuery |
|
|
useQuery = useQueryCall() and
|
|
node1 = useQuery.getParameter(0).getMember("queryFn").getReturn().getPromised().asSink() and
|
|
node2 = useQuery.getReturn().getMember("data").asSource()
|
|
)
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retrieves a call node representing a useQuery invocation from the '@tanstack/react-query' module.
|
|
*/
|
|
private API::CallNode useQueryCall() {
|
|
result = API::moduleImport("@tanstack/react-query").getMember("useQuery").getACall()
|
|
}
|