|
32 | 32 | *
|
33 | 33 | * TODO:
|
34 | 34 | * - extract
|
35 |
| - * - r2c-internal-project-depends-on-content |
36 | 35 | * - secrets
|
37 | 36 | * - steps (but not join)
|
38 | 37 | * - new metavariable types
|
@@ -74,15 +73,20 @@ type rule = {
|
74 | 73 | ?match_ <json name="match">: formula option;
|
75 | 74 | ?taint: taint option;
|
76 | 75 | ?extract: extract option;
|
77 |
| - (* TODO: steps, secrets, sca *) |
| 76 | + (* TODO: steps, secrets *) |
78 | 77 | (* TODO? product: product; *)
|
79 | 78 |
|
| 79 | + (* can work with match/taint/..., maybe not extract *) |
| 80 | + ?project_depends_on <json name="r2c-internal-project-depends-on">: |
| 81 | + project_depends_on option; |
| 82 | + |
80 | 83 | (* alt: later: could be replaced by a pattern-filename: *)
|
81 | 84 | ?paths: paths option;
|
82 | 85 |
|
83 | 86 | ?fix: string option;
|
84 | 87 | ?fix_regex: fix_regex option;
|
85 |
| - |
| 88 | + |
| 89 | + (* TODO? impose more constraints on metadata? standard fields? *) |
86 | 90 | ?metadata: raw_json option;
|
87 | 91 | ?options: rule_options option;
|
88 | 92 |
|
@@ -112,7 +116,7 @@ type severity = [
|
112 | 116 | | Info <json name="INFO">
|
113 | 117 | ]
|
114 | 118 |
|
115 |
| -(* coupling: language.ml *) |
| 119 | +(* coupling: Language.ml *) |
116 | 120 | type language = [
|
117 | 121 | (* programming (and configuration) languages *)
|
118 | 122 | | Apex <json name="apex">
|
@@ -183,7 +187,63 @@ type fix_regex = {
|
183 | 187 | ?count: int option;
|
184 | 188 | }
|
185 | 189 |
|
186 |
| -type rule_options <ocaml from="Rule_options" t="t"> = abstract |
| 190 | +(* coupling: Rule_options.atd |
| 191 | + * alt: <ocaml from="Rule_options" t="t"> but I prefer to repeat |
| 192 | + * its content here so one can fully see the syntax for a rule in one file. |
| 193 | + *) |
| 194 | +type rule_options = { |
| 195 | + ?constant_propagation: bool option; |
| 196 | + ?symbolic_propagation: bool option; |
| 197 | + ?taint_unify_mvars: bool option; |
| 198 | + ?taint_assume_safe_functions: bool option; |
| 199 | + ?taint_assume_safe_indexes: bool option; |
| 200 | + ?taint_assume_safe_comparisons: bool option; |
| 201 | + ?taint_assume_safe_booleans: bool option; |
| 202 | + ?taint_assume_safe_numbers: bool option; |
| 203 | + ?taint_only_propagate_through_assignments: bool option; |
| 204 | + ?ac_matching: bool option; |
| 205 | + ?commutative_boolop: bool option; |
| 206 | + ?commutative_compop: bool option; |
| 207 | + ?vardef_assign: bool option; |
| 208 | + ?flddef_assign: bool option; |
| 209 | + ?attr_expr: bool option; |
| 210 | + ?arrow_is_function: bool option; |
| 211 | + ?let_is_var: bool option; |
| 212 | + ?go_deeper_expr: bool option; |
| 213 | + ?go_deeper_stmt: bool option; |
| 214 | + ?implicit_deep_exprstmt: bool option; |
| 215 | + ?implicit_ellipsis: bool option; |
| 216 | + ?xml_singleton_loose_matching: bool option; |
| 217 | + ?xml_attrs_implicit_ellipsis: bool option; |
| 218 | + ?xml_children_ordered: bool option; |
| 219 | + ?generic_engine: generic_engine option; |
| 220 | + ?cpp_parsing_pref: cpp_parsing_opt option; |
| 221 | + ?generic_multiline: bool option; |
| 222 | + ?generic_braces: (string * string) list option; |
| 223 | + ~generic_extra_braces: (string * string) list; |
| 224 | + ~generic_extra_word_characters: string list; |
| 225 | + ~generic_caseless: bool; |
| 226 | + ?generic_ellipsis_max_span: int option; |
| 227 | + ?generic_comment_style: generic_comment_style option; |
| 228 | + ?interfile: bool option; |
| 229 | +} |
| 230 | + |
| 231 | +type cpp_parsing_opt = [ |
| 232 | + | AsFunDef <json name="as_fundef"> |
| 233 | + | AsVarDefWithCtor <json name="as_vardef_with_ctor"> |
| 234 | +] |
| 235 | + |
| 236 | +type generic_engine = [ |
| 237 | + | Aliengrep <json name="aliengrep"> |
| 238 | + | Spacegrep <json name="spacegrep"> |
| 239 | +] |
| 240 | + |
| 241 | +type generic_comment_style = [ |
| 242 | + | C <json name="c"> |
| 243 | + | Cpp <json name="cpp"> |
| 244 | + | Shell <json name="shell"> |
| 245 | +] |
| 246 | + |
187 | 247 |
|
188 | 248 | (*****************************************************************************)
|
189 | 249 | (* Formula *)
|
@@ -400,9 +460,43 @@ type propagator = {
|
400 | 460 | <json adapter.ocaml="Rule_schema_v2_adapter.Formula">
|
401 | 461 |
|
402 | 462 | (*****************************************************************************)
|
403 |
| -(* TODO: SSC *) |
| 463 | +(* Supply chain *) |
404 | 464 | (*****************************************************************************)
|
405 | 465 |
|
| 466 | +(* need an adapter there too *) |
| 467 | +type project_depends_on = [ |
| 468 | + | DependsBasic <json name="B"> of project_depends_on_basic |
| 469 | + | DependsEither <json name="E"> of project_depends_on_either |
| 470 | +] |
| 471 | +<json adapter.ocaml="Rule_schema_v2_adapter.ProjectDependsOn"> |
| 472 | + |
| 473 | +type project_depends_on_basic = { |
| 474 | + namespace: namespace; |
| 475 | + package: string; |
| 476 | + version: semver_range; |
| 477 | +} |
| 478 | + |
| 479 | +type project_depends_on_either = { |
| 480 | + depends_on_either <json name="depends-on-either">: |
| 481 | + project_depends_on_basic list; |
| 482 | +} |
| 483 | + |
| 484 | +(* coupling: semgrep_output_v1.ecosystem (better name than namespace) *) |
| 485 | +type namespace = [ |
| 486 | + | Npm <json name="npm"> |
| 487 | + | Pypi <json name="pypi"> |
| 488 | + | Gem <json name="gem"> |
| 489 | + | Gomod <json name="gomod"> |
| 490 | + | Cargo <json name="cargo"> |
| 491 | + | Maven <json name="maven"> |
| 492 | + | Composer <json name="composer"> |
| 493 | + | Nuget <json name="nuget"> |
| 494 | + | Pub <json name="pub"> |
| 495 | +] |
| 496 | + |
| 497 | +(* ex: < 0.0.8 *) |
| 498 | +type semver_range = string |
| 499 | + |
406 | 500 | (*****************************************************************************)
|
407 | 501 | (* TODO: Extract mode *)
|
408 | 502 | (*****************************************************************************)
|
|
0 commit comments