Skip to content

Commit 24f2a3c

Browse files
committed
Sync ApiGraphModels.qll
1 parent c8162f8 commit 24f2a3c

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,27 @@ module ModelInput {
164164
class TypeModel extends Unit {
165165
/**
166166
* Gets a data-flow node that is a source of the type `package;type`.
167+
*
168+
* This must not depend on API graphs, but ensures that an API node is generated for
169+
* the source.
167170
*/
168171
DataFlow::Node getASource(string package, string type) { none() }
169172

170173
/**
171-
* Gets a data flow node that is a sink of the type `package;type`,
174+
* Gets a data-flow node that is a sink of the type `package;type`,
172175
* usually because it is an argument passed to a parameter of that type.
176+
*
177+
* This must not depend on API graphs, but ensures that an API node is generated for
178+
* the sink.
173179
*/
174180
DataFlow::Node getASink(string package, string type) { none() }
181+
182+
/**
183+
* Gets an API node that is a source or sink of the type `package;type`.
184+
*
185+
* Unlike `getASource` and `getASink`, this may depend on API graphs.
186+
*/
187+
API::Node getAnApiNode(string package, string type) { none() }
175188
}
176189

177190
/**
@@ -434,6 +447,8 @@ private API::Node getNodeFromType(string package, string type) {
434447
or
435448
result = any(TypeModelDefEntry e).getNodeForType(package, type)
436449
or
450+
result = any(TypeModel t).getAnApiNode(package, type)
451+
or
437452
result = Specific::getExtraNodeFromType(package, type)
438453
}
439454

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,27 @@ module ModelInput {
164164
class TypeModel extends Unit {
165165
/**
166166
* Gets a data-flow node that is a source of the type `package;type`.
167+
*
168+
* This must not depend on API graphs, but ensures that an API node is generated for
169+
* the source.
167170
*/
168171
DataFlow::Node getASource(string package, string type) { none() }
169172

170173
/**
171-
* Gets a data flow node that is a sink of the type `package;type`,
174+
* Gets a data-flow node that is a sink of the type `package;type`,
172175
* usually because it is an argument passed to a parameter of that type.
176+
*
177+
* This must not depend on API graphs, but ensures that an API node is generated for
178+
* the sink.
173179
*/
174180
DataFlow::Node getASink(string package, string type) { none() }
181+
182+
/**
183+
* Gets an API node that is a source or sink of the type `package;type`.
184+
*
185+
* Unlike `getASource` and `getASink`, this may depend on API graphs.
186+
*/
187+
API::Node getAnApiNode(string package, string type) { none() }
175188
}
176189

177190
/**
@@ -434,6 +447,8 @@ private API::Node getNodeFromType(string package, string type) {
434447
or
435448
result = any(TypeModelDefEntry e).getNodeForType(package, type)
436449
or
450+
result = any(TypeModel t).getAnApiNode(package, type)
451+
or
437452
result = Specific::getExtraNodeFromType(package, type)
438453
}
439454

0 commit comments

Comments
 (0)