Skip to content

Commit 14c71a3

Browse files
committed
Sync shared files
1 parent 6f19fc2 commit 14c71a3

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,20 @@ module ModelInput {
168168
* A unit class for adding additional type model rows from CodeQL models.
169169
*/
170170
class TypeModel extends Unit {
171+
/**
172+
* Holds if any of the other predicates in this class might have a result
173+
* for the given `type`.
174+
*
175+
* The implementation of this predicate should not depend on `DataFlow::Node`.
176+
*/
177+
bindingset[type]
178+
predicate isTypeUsed(string type) { none() }
179+
171180
/**
172181
* Gets a data-flow node that is a source of the given `type`.
173182
*
183+
* Note that `type` should also be included in `isTypeUsed`.
184+
*
174185
* This must not depend on API graphs, but ensures that an API node is generated for
175186
* the source.
176187
*/
@@ -180,6 +191,8 @@ module ModelInput {
180191
* Gets a data-flow node that is a sink of the given `type`,
181192
* usually because it is an argument passed to a parameter of that type.
182193
*
194+
* Note that `type` should also be included in `isTypeUsed`.
195+
*
183196
* This must not depend on API graphs, but ensures that an API node is generated for
184197
* the sink.
185198
*/
@@ -188,6 +201,8 @@ module ModelInput {
188201
/**
189202
* Gets an API node that is a source or sink of the given `type`.
190203
*
204+
* Note that `type` should also be included in `isTypeUsed`.
205+
*
191206
* Unlike `getASource` and `getASink`, this may depend on API graphs.
192207
*/
193208
API::Node getAnApiNode(string type) { none() }
@@ -367,6 +382,8 @@ predicate isRelevantType(string type) {
367382
(
368383
Specific::isTypeUsed(type)
369384
or
385+
any(TypeModel model).isTypeUsed(type)
386+
or
370387
exists(TestAllModels t)
371388
)
372389
or

ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,20 @@ module ModelInput {
168168
* A unit class for adding additional type model rows from CodeQL models.
169169
*/
170170
class TypeModel extends Unit {
171+
/**
172+
* Holds if any of the other predicates in this class might have a result
173+
* for the given `type`.
174+
*
175+
* The implementation of this predicate should not depend on `DataFlow::Node`.
176+
*/
177+
bindingset[type]
178+
predicate isTypeUsed(string type) { none() }
179+
171180
/**
172181
* Gets a data-flow node that is a source of the given `type`.
173182
*
183+
* Note that `type` should also be included in `isTypeUsed`.
184+
*
174185
* This must not depend on API graphs, but ensures that an API node is generated for
175186
* the source.
176187
*/
@@ -180,6 +191,8 @@ module ModelInput {
180191
* Gets a data-flow node that is a sink of the given `type`,
181192
* usually because it is an argument passed to a parameter of that type.
182193
*
194+
* Note that `type` should also be included in `isTypeUsed`.
195+
*
183196
* This must not depend on API graphs, but ensures that an API node is generated for
184197
* the sink.
185198
*/
@@ -188,6 +201,8 @@ module ModelInput {
188201
/**
189202
* Gets an API node that is a source or sink of the given `type`.
190203
*
204+
* Note that `type` should also be included in `isTypeUsed`.
205+
*
191206
* Unlike `getASource` and `getASink`, this may depend on API graphs.
192207
*/
193208
API::Node getAnApiNode(string type) { none() }
@@ -367,6 +382,8 @@ predicate isRelevantType(string type) {
367382
(
368383
Specific::isTypeUsed(type)
369384
or
385+
any(TypeModel model).isTypeUsed(type)
386+
or
370387
exists(TestAllModels t)
371388
)
372389
or

0 commit comments

Comments
 (0)