@@ -144,8 +144,8 @@ type rule_id
144
144
coupling: with 'severity' in 'rule_schema_v2.atd'
145
145
*)
146
146
type match_severity
147
- <ocaml attr="deriving show, eq">
148
- <python decorator="dataclass(frozen=True)"> = [
147
+ <ocaml attr="deriving show, eq">
148
+ <python decorator="dataclass(frozen=True)"> = [
149
149
| Error <json name="ERROR">
150
150
| Warning <json name="WARNING">
151
151
| Experiment <json name="EXPERIMENT">
@@ -174,8 +174,8 @@ type match_severity
174
174
alt: could reuse match_severity but seems cleaner to define its own type
175
175
*)
176
176
type error_severity
177
- <ocaml attr="deriving show, eq">
178
- <python decorator="dataclass(frozen=True)"> = [
177
+ <ocaml attr="deriving show, eq">
178
+ <python decorator="dataclass(frozen=True)"> = [
179
179
| Error <json name="error">
180
180
| Warning <json name="warn">
181
181
| Info <json name="info">
@@ -188,11 +188,11 @@ type error_severity
188
188
Interfile_taint = requires interfile taint
189
189
Other_pro_feature = requires some non-taint pro feature *)
190
190
type pro_feature
191
- <ocaml attr="deriving show">
192
- <python decorator="dataclass(frozen=True)"> = {
193
- interproc_taint: bool;
194
- interfile_taint: bool;
195
- proprietary_language: bool;
191
+ <ocaml attr="deriving show">
192
+ <python decorator="dataclass(frozen=True)"> = {
193
+ interproc_taint: bool;
194
+ interfile_taint: bool;
195
+ proprietary_language: bool;
196
196
}
197
197
198
198
(* Report the engine used to detect each finding. Additionally, if we are able
@@ -209,17 +209,17 @@ type pro_feature
209
209
we're leaving them as is
210
210
*)
211
211
type engine_of_finding
212
- <ocaml attr="deriving show">
213
- <python decorator="dataclass(frozen=True)"> = [
212
+ <ocaml attr="deriving show">
213
+ <python decorator="dataclass(frozen=True)"> = [
214
214
| OSS
215
215
| PRO
216
216
(* Semgrep 1.64.0 or later *)
217
217
| PRO_REQUIRED of pro_feature
218
218
]
219
219
220
220
type engine_kind
221
- <ocaml attr="deriving show">
222
- <python decorator="dataclass(frozen=True)"> = [
221
+ <ocaml attr="deriving show">
222
+ <python decorator="dataclass(frozen=True)"> = [
223
223
| OSS
224
224
| PRO
225
225
]
@@ -467,8 +467,8 @@ type match_intermediate_var <python decorator="dataclass(frozen=True)"> = {
467
467
* Error.string_of_error_type() for osemgrep.
468
468
*)
469
469
type error_type
470
- <ocaml attr="deriving show">
471
- <python decorator="dataclass(frozen=True, order=True)"> = [
470
+ <ocaml attr="deriving show">
471
+ <python decorator="dataclass(frozen=True, order=True)"> = [
472
472
(* File parsing related errors;
473
473
coupling: if you add a target parse error then metrics for
474
474
cli need to be updated. See cli/src/semgrep/parsing_data.py.
@@ -1061,6 +1061,7 @@ type todo = int
1061
1061
(* This is also known as Software Composition Analysis (SCA) *)
1062
1062
1063
1063
(* EXPERIMENTAL *)
1064
+ (* part of cli_match_extra *)
1064
1065
type sca_info = {
1065
1066
reachable: bool;
1066
1067
reachability_rule: bool;
@@ -1074,11 +1075,19 @@ type dependency_match = {
1074
1075
lockfile: string;
1075
1076
}
1076
1077
1078
+ type dependency_pattern = {
1079
+ ecosystem: ecosystem;
1080
+ package: string;
1081
+ semver_range: string;
1082
+ }
1083
+
1077
1084
(* both ecosystem and transitivity below have frozen=True so the generated
1078
1085
* classes can be hashed and put in sets (see calls to reachable_deps.add()
1079
1086
* in semgrep SCA code)
1080
1087
*)
1081
- type ecosystem <python decorator="dataclass(frozen=True)"> <ocaml attr="deriving show,eq"> = [
1088
+ type ecosystem
1089
+ <python decorator="dataclass(frozen=True)">
1090
+ <ocaml attr="deriving show,eq"> = [
1082
1091
| Npm <json name="npm">
1083
1092
| Pypi <json name="pypi">
1084
1093
| Gem <json name="gem">
@@ -1094,23 +1103,6 @@ type ecosystem <python decorator="dataclass(frozen=True)"> <ocaml attr="deriving
1094
1103
| Hex <json name="hex">
1095
1104
]
1096
1105
1097
- type transitivity <python decorator="dataclass(frozen=True)"> <ocaml attr="deriving show,eq"> = [
1098
- | Direct <json name="direct">
1099
- | Transitive <json name="transitive">
1100
- | Unknown <json name="unknown">
1101
- ]
1102
-
1103
- type dependency_pattern = {
1104
- ecosystem: ecosystem;
1105
- package: string;
1106
- semver_range: string;
1107
- }
1108
-
1109
- type dependency_child <python decorator="dataclass(frozen=True)"> = {
1110
- package: string;
1111
- version: string;
1112
- }
1113
-
1114
1106
type found_dependency = {
1115
1107
package: string;
1116
1108
version: string;
@@ -1147,7 +1139,35 @@ type found_dependency = {
1147
1139
?git_ref: string option;
1148
1140
}
1149
1141
1150
- (* json names are to maintain backwards compatibility with the python enum it is replacing *)
1142
+ type transitivity
1143
+ <python decorator="dataclass(frozen=True)">
1144
+ <ocaml attr="deriving show,eq"> = [
1145
+ | Direct <json name="direct">
1146
+ | Transitive <json name="transitive">
1147
+ | Unknown <json name="unknown">
1148
+ ]
1149
+
1150
+
1151
+ type dependency_child <python decorator="dataclass(frozen=True)"> = {
1152
+ package: string;
1153
+ version: string;
1154
+ }
1155
+
1156
+ (* Used in ci_scan_complete *)
1157
+ type dependency_parser_error = {
1158
+ path: string;
1159
+ parser: sca_parser_name;
1160
+ reason: string;
1161
+ (* Not using `position` because this type must be backwards compatible with the python
1162
+ * class it is replacing.
1163
+ *)
1164
+ ?line: int option;
1165
+ ?col: int option;
1166
+ ?text: string option;
1167
+ }
1168
+
1169
+ (* json names are to maintain backwards compatibility with the python enum it is
1170
+ * replacing *)
1151
1171
type sca_parser_name = [
1152
1172
| Gemfile_lock <json name="gemfile_lock">
1153
1173
| Go_mod <json name="go_mod">
@@ -1171,17 +1191,6 @@ type sca_parser_name = [
1171
1191
| Mix_lock <json name="mix_lock">
1172
1192
]
1173
1193
1174
- type dependency_parser_error = {
1175
- path: string;
1176
- parser: sca_parser_name;
1177
- reason: string;
1178
- (* Not using `position` because this type must be backwards compatible with the python
1179
- * class it is replacing.
1180
- *)
1181
- ?line: int option;
1182
- ?col: int option;
1183
- ?text: string option;
1184
- }
1185
1194
1186
1195
(*****************************************************************************)
1187
1196
(* Semgrep Secrets *)
@@ -1205,8 +1214,8 @@ type historical_info = {
1205
1214
(*****************************************************************************)
1206
1215
1207
1216
(* EXPERIMENTAL: do not rely on the types in this section; those are internal
1208
- * types used to communicate with the Semgrep backend and are not meant
1209
- * to be consumed directly by Semgrep users or tools wrapping up Semgrep.
1217
+ * types used to communicate with the Semgrep App backend and are not meant
1218
+ * to be consumed directly by Semgrep users or tools wrapping Semgrep.
1210
1219
*
1211
1220
* The sequence of HTTP requests is mostly:
1212
1221
* - /deployments/current with token
@@ -1294,19 +1303,19 @@ type deployment_config <ocaml attr="deriving show"> = {
1294
1303
inherit has_features;
1295
1304
}
1296
1305
1297
- (* Content of the .semgrepconfig.yml in the repository.
1306
+ (* Content of a possible .semgrepconfig.yml in the repository.
1298
1307
*
1299
1308
* This config allows to configure Semgrep per repo, e.g., to store
1300
1309
* a category/tag like "webapp" in a repo so that the Semgrep WebApp can
1301
1310
* return a set of relevant rules automatically for this repo in scan_config
1302
1311
* later when given this ci_config_from_repo in the scan_request.
1303
1312
*)
1304
1313
type ci_config_from_repo = {
1305
- (* version of the .semgrepconfig.yml format. "V1 " right now (useful?) *)
1314
+ (* version of the .semgrepconfig.yml format. "v1 " right now (useful?) *)
1306
1315
~version <python default="Version('v1')"> <ts default="'v1'">: version;
1307
1316
?tags: tag list option;
1308
1317
}
1309
- (* ?? ex? *)
1318
+ (* ex: "webapp" *)
1310
1319
type tag = string
1311
1320
1312
1321
(* Response by the backend to the CLI to the POST /scans/<scan_id>/config *)
@@ -1320,7 +1329,7 @@ type scan_config = {
1320
1329
policy_names: string list;
1321
1330
(* rules raw content in JSON format (but still sent as a string) *)
1322
1331
rule_config: string;
1323
- (* since 1.47.0 *)
1332
+ (* since 1.47.0 but not created by the backend (nor used by the CLI) *)
1324
1333
?ci_config_from_cloud: ci_config_from_cloud option;
1325
1334
1326
1335
(* Deprecated: should rely on ci_config_from_cloud instead *)
@@ -1442,10 +1451,11 @@ type scan_metadata = {
1442
1451
1443
1452
(* Sent by the CLI to the POST /api/cli/scans to create a scan. *)
1444
1453
type scan_request = {
1445
- (* added in 1.43 as options, and made mandatory since 1.98.0 *)
1446
- project_metadata: project_metadata; (* replacing meta below *)
1447
- project_config: ci_config_from_repo;
1454
+ (* added in 1.43 as options, and mandatory since 1.98.0 (replacing meta) *)
1455
+ project_metadata: project_metadata;
1448
1456
scan_metadata: scan_metadata;
1457
+ (* added in 1.43 (used to be in meta) *)
1458
+ ?project_config: ci_config_from_repo option;
1449
1459
(* deprecated: moved as an option in 1.98.0 and was used until 1.43ish
1450
1460
* old: 'meta: project_metadata;' before 1.43
1451
1461
*)
@@ -1650,7 +1660,8 @@ type ci_scan_results_response_error <ocaml attr="deriving show"> = {
1650
1660
type ci_scan_complete = {
1651
1661
exit_code: int;
1652
1662
stats: ci_scan_complete_stats;
1653
- ?dependencies: ci_scan_dependencies option; (* remove when min version is 1.38.0 *)
1663
+ (* TODO: remove dependencies when min version is 1.38.0 *)
1664
+ ?dependencies: ci_scan_dependencies option;
1654
1665
?dependency_parser_errors: dependency_parser_error list option;
1655
1666
(* since 1.31.0 *)
1656
1667
?task_id: string option;
0 commit comments