Skip to content

Commit a637714

Browse files
Copilotowen-mc
andauthored
Convert C++ CSV models from QL files to .model.yml data extensions
Migrate ZeroMQ models from ZMQ.qll and getc-family source models from Gets.qll into new .model.yml files in the ext/ directory. Agent-Logs-Url: https://github.com/github/codeql/sessions/da8f5e5b-35f7-47a4-afa0-750616e3df5b Co-authored-by: owen-mc <62447351+owen-mc@users.noreply.github.com>
1 parent 4748c4a commit a637714

File tree

6 files changed

+45
-63
lines changed

6 files changed

+45
-63
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* ZeroMQ and `getc`-family models have been migrated from inline CSV specifications in QL files to `.model.yml` data extension files in the `ext/` directory.

cpp/ql/lib/ext/ZMQ.model.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ZeroMQ networking library models
2+
extensions:
3+
- addsTo:
4+
pack: codeql/cpp-all
5+
extensible: sourceModel
6+
data: # namespace, type, subtypes, name, signature, ext, output, kind, provenance
7+
- ["", "", False, "zmq_recv", "", "", "Argument[*1]", "remote", "manual"]
8+
- ["", "", False, "zmq_recvmsg", "", "", "Argument[*1]", "remote", "manual"]
9+
- ["", "", False, "zmq_msg_recv", "", "", "Argument[*0]", "remote", "manual"]
10+
- addsTo:
11+
pack: codeql/cpp-all
12+
extensible: sinkModel
13+
data: # namespace, type, subtypes, name, signature, ext, input, kind, provenance
14+
- ["", "", False, "zmq_send", "", "", "Argument[*1]", "remote-sink", "manual"]
15+
- ["", "", False, "zmq_sendmsg", "", "", "Argument[*1]", "remote-sink", "manual"]
16+
- ["", "", False, "zmq_msg_send", "", "", "Argument[*0]", "remote-sink", "manual"]
17+
- addsTo:
18+
pack: codeql/cpp-all
19+
extensible: summaryModel
20+
data: # namespace, type, subtypes, name, signature, ext, input, output, kind, provenance
21+
- ["", "", False, "zmq_msg_init_data", "", "", "Argument[*1]", "Argument[*0]", "taint", "manual"]
22+
- ["", "", False, "zmq_msg_data", "", "", "Argument[*0]", "ReturnValue[*]", "taint", "manual"]

cpp/ql/lib/ext/getc.model.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Models for getc and similar character-reading functions
2+
extensions:
3+
- addsTo:
4+
pack: codeql/cpp-all
5+
extensible: sourceModel
6+
data: # namespace, type, subtypes, name, signature, ext, output, kind, provenance
7+
- ["", "", False, "getc", "", "", "ReturnValue", "remote", "manual"]
8+
- ["", "", False, "getwc", "", "", "ReturnValue", "remote", "manual"]
9+
- ["", "", False, "_getc_nolock", "", "", "ReturnValue", "remote", "manual"]
10+
- ["", "", False, "_getwc_nolock", "", "", "ReturnValue", "remote", "manual"]
11+
- ["", "", False, "getch", "", "", "ReturnValue", "local", "manual"]
12+
- ["", "", False, "_getch", "", "", "ReturnValue", "local", "manual"]
13+
- ["", "", False, "_getwch", "", "", "ReturnValue", "local", "manual"]
14+
- ["", "", False, "_getch_nolock", "", "", "ReturnValue", "local", "manual"]
15+
- ["", "", False, "_getwch_nolock", "", "", "ReturnValue", "local", "manual"]
16+
- ["", "", False, "getchar", "", "", "ReturnValue", "local", "manual"]
17+
- ["", "", False, "getwchar", "", "", "ReturnValue", "local", "manual"]
18+
- ["", "", False, "_getchar_nolock", "", "", "ReturnValue", "local", "manual"]
19+
- ["", "", False, "_getwchar_nolock", "", "", "ReturnValue", "local", "manual"]

cpp/ql/lib/semmle/code/cpp/models/Models.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ private import implementations.SqLite3
4848
private import implementations.PostgreSql
4949
private import implementations.System
5050
private import implementations.StructuredExceptionHandling
51-
private import implementations.ZMQ
5251
private import implementations.Win32CommandExecution
5352
private import implementations.CA2AEX
5453
private import implementations.CComBSTR

cpp/ql/lib/semmle/code/cpp/models/implementations/Gets.qll

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,3 @@ private class GetsFunction extends DataFlowFunction, ArrayFunction, AliasFunctio
113113
override predicate hasArrayOutput(int bufParam) { bufParam = 0 }
114114
}
115115

116-
/**
117-
* A model for `getc` and similar functions that are flow sources.
118-
*/
119-
private class GetcSource extends SourceModelCsv {
120-
override predicate row(string row) {
121-
row =
122-
[
123-
";;false;getc;;;ReturnValue;remote", ";;false;getwc;;;ReturnValue;remote",
124-
";;false;_getc_nolock;;;ReturnValue;remote", ";;false;_getwc_nolock;;;ReturnValue;remote",
125-
";;false;getch;;;ReturnValue;local", ";;false;_getch;;;ReturnValue;local",
126-
";;false;_getwch;;;ReturnValue;local", ";;false;_getch_nolock;;;ReturnValue;local",
127-
";;false;_getwch_nolock;;;ReturnValue;local", ";;false;getchar;;;ReturnValue;local",
128-
";;false;getwchar;;;ReturnValue;local", ";;false;_getchar_nolock;;;ReturnValue;local",
129-
";;false;_getwchar_nolock;;;ReturnValue;local",
130-
]
131-
}
132-
}

cpp/ql/lib/semmle/code/cpp/models/implementations/ZMQ.qll

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)