Skip to content

Commit 929419a

Browse files
authored
Merge pull request #8254 from asgerf/ruby/mad-prototype
Ruby: initial prototype of models-as-data
2 parents 8bf1729 + e1976da commit 929419a

File tree

31 files changed

+1256
-97
lines changed

31 files changed

+1256
-97
lines changed

config/identical-files.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,5 +515,9 @@
515515
"java/ql/lib/semmle/code/java/dataflow/internal/AccessPathSyntax.qll",
516516
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/AccessPathSyntax.qll",
517517
"ruby/ql/lib/codeql/ruby/dataflow/internal/AccessPathSyntax.qll"
518+
],
519+
"ApiGraphModels": [
520+
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll",
521+
"ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll"
518522
]
519523
}

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,12 @@ module API {
371371
/**
372372
* An API entry point.
373373
*
374-
* Extend this class to define additional API entry points other than modules.
375-
* Typical examples include global variables.
374+
* By default, API graph nodes are only created for nodes that come from an external
375+
* library or escape into an external library. The points where values are cross the boundary
376+
* between codebases are called "entry points".
377+
*
378+
* Imports and exports are considered entry points by default, but additional entry points may
379+
* be added by extending this class. Typical examples include global variables.
376380
*/
377381
abstract class EntryPoint extends string {
378382
bindingset[this]
@@ -385,7 +389,10 @@ module API {
385389
abstract DataFlow::Node getARhs();
386390

387391
/** Gets an API-node for this entry point. */
388-
API::Node getNode() { result = root().getASuccessor(Label::entryPoint(this)) }
392+
API::Node getANode() { result = root().getASuccessor(Label::entryPoint(this)) }
393+
394+
/** DEPRECATED. Use `getANode()` instead. */
395+
deprecated API::Node getNode() { result = this.getANode() }
389396
}
390397

391398
/**

javascript/ql/lib/semmle/javascript/frameworks/D3.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module D3 {
2323
or
2424
result = API::moduleImport("d3-node").getInstance().getMember("d3")
2525
or
26-
result = any(D3GlobalEntry i).getNode()
26+
result = any(D3GlobalEntry i).getANode()
2727
}
2828

2929
/**

javascript/ql/lib/semmle/javascript/frameworks/History.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module History {
1717
* Gets a reference to the [`history`](https://npmjs.org/package/history) library.
1818
*/
1919
private API::Node history() {
20-
result = [API::moduleImport("history"), any(HistoryGlobalEntry h).getNode()]
20+
result = [API::moduleImport("history"), any(HistoryGlobalEntry h).getANode()]
2121
}
2222

2323
/**

javascript/ql/lib/semmle/javascript/frameworks/Immutable.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private module Immutable {
2727
API::Node immutableImport() {
2828
result = API::moduleImport("immutable")
2929
or
30-
result = any(ImmutableGlobalEntry i).getNode()
30+
result = any(ImmutableGlobalEntry i).getANode()
3131
}
3232

3333
/**

javascript/ql/lib/semmle/javascript/frameworks/Logging.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private module Console {
4545
*/
4646
private API::Node console() {
4747
result = API::moduleImport("console") or
48-
result = any(ConsoleGlobalEntry e).getNode()
48+
result = any(ConsoleGlobalEntry e).getANode()
4949
}
5050

5151
/**

javascript/ql/lib/semmle/javascript/frameworks/Nest.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ module NestJS {
151151
private API::Node validationPipe() {
152152
result = nestjs().getMember("ValidationPipe")
153153
or
154-
result = any(ValidationNodeEntry e).getNode()
154+
result = any(ValidationNodeEntry e).getANode()
155155
}
156156

157157
/**

javascript/ql/lib/semmle/javascript/frameworks/Redux.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ module Redux {
11111111

11121112
/** A heuristic call to `connect`, recognized by it taking arguments named `mapStateToProps` and `mapDispatchToProps`. */
11131113
private class HeuristicConnectFunction extends ConnectCall {
1114-
HeuristicConnectFunction() { this = any(HeuristicConnectEntryPoint e).getNode().getACall() }
1114+
HeuristicConnectFunction() { this = any(HeuristicConnectEntryPoint e).getANode().getACall() }
11151115

11161116
override API::Node getMapStateToProps() {
11171117
result = getAParameter() and

javascript/ql/lib/semmle/javascript/frameworks/TrustedTypes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module TrustedTypes {
1919
override DataFlow::Node getARhs() { none() }
2020
}
2121

22-
private API::Node trustedTypesObj() { result = any(TrustedTypesEntry entry).getNode() }
22+
private API::Node trustedTypesObj() { result = any(TrustedTypesEntry entry).getANode() }
2323

2424
/** A call to `trustedTypes.createPolicy`. */
2525
class PolicyCreation extends API::CallNode {

javascript/ql/lib/semmle/javascript/frameworks/Vue.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module Vue {
3535
API::Node vueLibrary() {
3636
result = API::moduleImport("vue")
3737
or
38-
result = any(GlobalVueEntryPoint e).getNode()
38+
result = any(GlobalVueEntryPoint e).getANode()
3939
}
4040

4141
/**
@@ -51,7 +51,7 @@ module Vue {
5151
or
5252
result = vueLibrary().getMember("component").getReturn()
5353
or
54-
result = any(VueFileImportEntryPoint e).getNode()
54+
result = any(VueFileImportEntryPoint e).getANode()
5555
}
5656

5757
/**

0 commit comments

Comments
 (0)