Skip to content

Commit 083be30

Browse files
committed
Shared: Add neutralModel extensible predicate
The neutralModel extensible predicate already exists in Java and C#, so this change brings the dynamic languages more in line with static languages. The Model Editor uses this predicate to mark endpoints as "not interesting" from a data flow perspective.
1 parent 38ecde0 commit 083be30

File tree

6 files changed

+39
-3
lines changed

6 files changed

+39
-3
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ extensible predicate sourceModel(string type, string path, string kind);
1717
extensible predicate sinkModel(string type, string path, string kind);
1818

1919
/**
20-
* Holds if calls to `(type, path)`, the value referred to by `input`
20+
* Holds if in calls to `(type, path)`, the value referred to by `input`
2121
* can flow to the value referred to by `output`.
2222
*
2323
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving steps,
2424
* respectively.
2525
*/
2626
extensible predicate summaryModel(string type, string path, string input, string output, string kind);
2727

28+
/**
29+
* Holds if calls to `(type, path)` should be considered neutral. The meaning of this depends on the `kind`.
30+
* If `kind` is `summary`, the call does not propagate data flow. If `kind` is `source`, the call is not a source.
31+
* If `kind` is `sink`, the call is not a sink.
32+
*/
33+
extensible predicate neutralModel(string type, string path, string kind);
34+
2835
/**
2936
* Holds if `(type2, path)` should be seen as an instance of `type1`.
3037
*/

javascript/ql/lib/semmle/javascript/frameworks/data/internal/model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ extensions:
1515
extensible: summaryModel
1616
data: []
1717

18+
- addsTo:
19+
pack: codeql/javascript-all
20+
extensible: neutralModel
21+
data: []
22+
1823
- addsTo:
1924
pack: codeql/javascript-all
2025
extensible: typeModel

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ extensible predicate sourceModel(string type, string path, string kind);
1717
extensible predicate sinkModel(string type, string path, string kind);
1818

1919
/**
20-
* Holds if calls to `(type, path)`, the value referred to by `input`
20+
* Holds if in calls to `(type, path)`, the value referred to by `input`
2121
* can flow to the value referred to by `output`.
2222
*
2323
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving steps,
2424
* respectively.
2525
*/
2626
extensible predicate summaryModel(string type, string path, string input, string output, string kind);
2727

28+
/**
29+
* Holds if calls to `(type, path)` should be considered neutral. The meaning of this depends on the `kind`.
30+
* If `kind` is `summary`, the call does not propagate data flow. If `kind` is `source`, the call is not a source.
31+
* If `kind` is `sink`, the call is not a sink.
32+
*/
33+
extensible predicate neutralModel(string type, string path, string kind);
34+
2835
/**
2936
* Holds if `(type2, path)` should be seen as an instance of `type1`.
3037
*/

python/ql/lib/semmle/python/frameworks/data/internal/empty.model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ extensions:
1515
extensible: summaryModel
1616
data: []
1717

18+
- addsTo:
19+
pack: codeql/python-all
20+
extensible: neutralModel
21+
data: []
22+
1823
- addsTo:
1924
pack: codeql/python-all
2025
extensible: typeModel

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@ extensible predicate sourceModel(string type, string path, string kind);
1717
extensible predicate sinkModel(string type, string path, string kind);
1818

1919
/**
20-
* Holds if calls to `(type, path)`, the value referred to by `input`
20+
* Holds if in calls to `(type, path)`, the value referred to by `input`
2121
* can flow to the value referred to by `output`.
2222
*
2323
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving steps,
2424
* respectively.
2525
*/
2626
extensible predicate summaryModel(string type, string path, string input, string output, string kind);
2727

28+
/**
29+
* Holds if calls to `(type, path)` should be considered neutral. The meaning of this depends on the `kind`.
30+
* If `kind` is `summary`, the call does not propagate data flow. If `kind` is `source`, the call is not a source.
31+
* If `kind` is `sink`, the call is not a sink.
32+
*/
33+
extensible predicate neutralModel(string type, string path, string kind);
34+
2835
/**
2936
* Holds if `(type2, path)` should be seen as an instance of `type1`.
3037
*/

ruby/ql/lib/codeql/ruby/frameworks/data/internal/model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ extensions:
1515
extensible: summaryModel
1616
data: []
1717

18+
- addsTo:
19+
pack: codeql/ruby-all
20+
extensible: neutralModel
21+
data: []
22+
1823
- addsTo:
1924
pack: codeql/ruby-all
2025
extensible: typeModel

0 commit comments

Comments
 (0)