Skip to content

Commit

Permalink
Merge pull request #14631 from hmac/hmac-dynamic-neutral-model
Browse files Browse the repository at this point in the history
JS/Ruby/Python: Add neutralModel extensible predicate
  • Loading branch information
hmac authored Oct 30, 2023
2 parents 3a9ffe1 + 083be30 commit dc9f171
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions codeql-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ provide:
- "swift/extractor-pack/codeql-extractor.yml"
- "swift/integration-tests/qlpack.yml"
- "ql/extractor-pack/codeql-extractor.yml"
- ".github/codeql/extensions/**/codeql-pack.yml"

versionPolicies:
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ extensible predicate sourceModel(string type, string path, string kind);
extensible predicate sinkModel(string type, string path, string kind);

/**
* Holds if calls to `(type, path)`, the value referred to by `input`
* Holds if in calls to `(type, path)`, the value referred to by `input`
* can flow to the value referred to by `output`.
*
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving steps,
* respectively.
*/
extensible predicate summaryModel(string type, string path, string input, string output, string kind);

/**
* Holds if calls to `(type, path)` should be considered neutral. The meaning of this depends on the `kind`.
* If `kind` is `summary`, the call does not propagate data flow. If `kind` is `source`, the call is not a source.
* If `kind` is `sink`, the call is not a sink.
*/
extensible predicate neutralModel(string type, string path, string kind);

/**
* Holds if `(type2, path)` should be seen as an instance of `type1`.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ extensions:
extensible: summaryModel
data: []

- addsTo:
pack: codeql/javascript-all
extensible: neutralModel
data: []

- addsTo:
pack: codeql/javascript-all
extensible: typeModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ extensible predicate sourceModel(string type, string path, string kind);
extensible predicate sinkModel(string type, string path, string kind);

/**
* Holds if calls to `(type, path)`, the value referred to by `input`
* Holds if in calls to `(type, path)`, the value referred to by `input`
* can flow to the value referred to by `output`.
*
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving steps,
* respectively.
*/
extensible predicate summaryModel(string type, string path, string input, string output, string kind);

/**
* Holds if calls to `(type, path)` should be considered neutral. The meaning of this depends on the `kind`.
* If `kind` is `summary`, the call does not propagate data flow. If `kind` is `source`, the call is not a source.
* If `kind` is `sink`, the call is not a sink.
*/
extensible predicate neutralModel(string type, string path, string kind);

/**
* Holds if `(type2, path)` should be seen as an instance of `type1`.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ extensions:
extensible: summaryModel
data: []

- addsTo:
pack: codeql/python-all
extensible: neutralModel
data: []

- addsTo:
pack: codeql/python-all
extensible: typeModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ extensible predicate sourceModel(string type, string path, string kind);
extensible predicate sinkModel(string type, string path, string kind);

/**
* Holds if calls to `(type, path)`, the value referred to by `input`
* Holds if in calls to `(type, path)`, the value referred to by `input`
* can flow to the value referred to by `output`.
*
* `kind` should be either `value` or `taint`, for value-preserving or taint-preserving steps,
* respectively.
*/
extensible predicate summaryModel(string type, string path, string input, string output, string kind);

/**
* Holds if calls to `(type, path)` should be considered neutral. The meaning of this depends on the `kind`.
* If `kind` is `summary`, the call does not propagate data flow. If `kind` is `source`, the call is not a source.
* If `kind` is `sink`, the call is not a sink.
*/
extensible predicate neutralModel(string type, string path, string kind);

/**
* Holds if `(type2, path)` should be seen as an instance of `type1`.
*/
Expand Down
5 changes: 5 additions & 0 deletions ruby/ql/lib/codeql/ruby/frameworks/data/internal/model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ extensions:
extensible: summaryModel
data: []

- addsTo:
pack: codeql/ruby-all
extensible: neutralModel
data: []

- addsTo:
pack: codeql/ruby-all
extensible: typeModel
Expand Down

0 comments on commit dc9f171

Please sign in to comment.