@@ -274,20 +274,16 @@ type cli_match_extra = {
274
274
?metavars: metavars option;
275
275
276
276
(* Those fields are derived from the rule but the metavariables
277
- * they contain have been expanded to their concrete value.
278
- *)
277
+ * they contain have been expanded to their concrete value. *)
279
278
message: string;
279
+
280
280
(* If present, semgrep was able to compute a string that should be
281
281
* inserted in place of the text in the matched range in order to fix the
282
- * finding.
283
- * Note that this is the result of applying both the fix: or fix_regex:
284
- * in a rule.
285
- *)
282
+ * finding. Note that this is the result of applying both the fix: or
283
+ * fix_regex: in a rule. *)
286
284
?fix: string option;
287
-
288
285
(* TODO: done with monkey patching right now in the Python code,
289
- * and seems to be used only when sending findings to the backend.
290
- *)
286
+ * and seems to be used only when sending findings to the backend. *)
291
287
?fixed_lines: string list option;
292
288
293
289
(* fields coming from the rule *)
@@ -298,20 +294,18 @@ type cli_match_extra = {
298
294
fingerprint: string;
299
295
lines: string;
300
296
301
- (* extra fields *)
297
+ (* for nosemgrep *)
302
298
?is_ignored: bool option;
303
299
304
300
(* EXPERIMENTAL: added by dependency_aware code *)
305
- ?sca_info: sca_info option;
306
-
301
+ ?sca_info: sca_match option;
307
302
(* EXPERIMENTAL: If present indicates the status of postprocessor validation.
308
303
* This field not being present should be equivalent to No_validator.
309
304
* Added in semgrep 1.37.0 *)
310
305
?validation_state: validation_state option;
311
306
(* EXPERIMENTAL: added by secrets post-processing & historical scanning code
312
307
* Since 1.60.0. *)
313
308
?historical_info: historical_info option;
314
-
315
309
(* EXPERIMENTAL: For now, present only for taint findings. May be extended to
316
310
* otherslater on. *)
317
311
?dataflow_trace: match_dataflow_trace option;
@@ -530,41 +524,40 @@ type transitivity
530
524
]
531
525
532
526
(* part of cli_match_extra *)
533
- type sca_info = {
527
+ type sca_match = {
534
528
reachable: bool;
535
529
reachability_rule: bool;
536
530
sca_finding_schema: int;
537
531
dependency_match: dependency_match;
538
532
}
539
533
540
534
type dependency_match = {
541
- dependency_pattern: dependency_pattern ;
535
+ dependency_pattern: sca_pattern ;
542
536
found_dependency: found_dependency;
543
537
lockfile: fpath;
544
538
}
545
539
546
- type dependency_pattern = {
540
+ type sca_pattern = {
547
541
ecosystem: ecosystem;
548
542
package: string;
549
543
semver_range: string;
550
544
}
551
545
546
+ (* alt: sca_dependency? *)
552
547
type found_dependency = {
553
548
package: string;
554
549
version: string;
555
550
ecosystem: ecosystem;
551
+ (* ??? *)
556
552
allowed_hashes: (string * string list) list
557
- <json repr="object">
558
- <python repr="dict">
559
- <ts repr="map">;
553
+ <json repr="object"> <python repr="dict"> <ts repr="map">;
560
554
?resolved_url: string option;
561
555
transitivity: transitivity;
562
556
(* Path to the manifest file that defines the project containing this
563
557
* dependency. Examples: package.json, nested/folder/pom.xml
564
558
*)
565
559
?manifest_path: fpath option;
566
560
(* Path to the lockfile that contains this dependency.
567
- *
568
561
* Examples: package-lock.json, nested/folder/requirements.txt, go.mod
569
562
* Since 1.87.0
570
563
*)
@@ -1476,12 +1469,11 @@ type finding = {
1476
1469
1477
1470
?fixed_lines: string list option;
1478
1471
1479
- ?sca_info: sca_info option;
1480
- (* Note that this contains code!
1481
- * TODO? do we need to send this to the App?
1482
- *)
1472
+ (* added in ?? *)
1473
+ ?sca_info: sca_match option;
1474
+ (* Note that this contains code! TODO? do we need to send this to the App? *)
1483
1475
?dataflow_trace: match_dataflow_trace option;
1484
- (* Added in semgrep 1.39.0 see comments in cli_match_extra. *)
1476
+ (* Added in semgrep 1.39.0 see comments in cli_match_extra *)
1485
1477
?validation_state: validation_state option;
1486
1478
(* Added in semgrep 1.65.0 see comments in cli_match_extra *)
1487
1479
?historical_info: historical_info option;
@@ -1801,7 +1793,6 @@ type core_output = {
1801
1793
results: core_match list;
1802
1794
(* errors are guaranteed to be duplicate free; see also Report.ml *)
1803
1795
errors: core_error list;
1804
-
1805
1796
inherit cli_output_extra;
1806
1797
}
1807
1798
@@ -1812,32 +1803,26 @@ type core_match <python decorator="dataclass(frozen=True)"> = {
1812
1803
extra: core_match_extra;
1813
1804
}
1814
1805
1815
- (* TODO: try to make it as close as possible to 'cli_match_extra' below *)
1806
+ (* TODO: try to make it as close as possible to 'cli_match_extra' below
1807
+ * See the corresponding comment in cli_match_extra for more information
1808
+ * about the fields below.
1809
+ *)
1816
1810
type core_match_extra <python decorator="dataclass(frozen=True)"> = {
1811
+ metavars: metavars;
1812
+ engine_kind: engine_of_finding;
1813
+ is_ignored: bool;
1817
1814
(* These fields generally come from the rule, but may be set here if they're
1818
1815
* being overriden for that particular finding. This would currently occur
1819
- * for rule with a validator for secrets, depending on what the valdiator
1816
+ * for rule with a validator for secrets, depending on what the validator
1820
1817
* might match, but could be expanded in the future.
1821
- *
1822
- * Added in semgrep 1.44.0 *)
1818
+ *)
1823
1819
?message: string option;
1824
1820
?metadata: raw_json option;
1825
1821
?severity: match_severity option;
1826
-
1827
- metavars: metavars;
1828
- (* old: was called rendered_fix *)
1829
1822
?fix: string option;
1830
-
1831
1823
?dataflow_trace: match_dataflow_trace option;
1832
- engine_kind: engine_of_finding;
1833
- (* for nosemgrep *)
1834
- is_ignored: bool;
1835
- (* If present indicates the status of postprocessor validation. This field
1836
- * not being present should be equivalent to No_validator.
1837
- * Added in semgrep 1.37.0 *)
1824
+ ?sca_match: sca_match option;
1838
1825
?validation_state : validation_state option;
1839
- (* EXPERIMENTAL: added by secrets post-processing & historical scanning code.
1840
- * Since 1.63.0. *)
1841
1826
?historical_info: historical_info option;
1842
1827
(* Escape hatch to pass untyped info from semgrep-core to the semgrep output.
1843
1828
* Useful for quick experiments, especially when combined with semgrep
@@ -1860,7 +1845,7 @@ type core_error <python decorator="dataclass(frozen=True)"> = {
1860
1845
?details: string option;
1861
1846
?location: location option;
1862
1847
?rule_id: rule_id option;
1863
- }
1848
+ }
1864
1849
1865
1850
(*****************************************************************************)
1866
1851
(* semgrep-core JSON input via -targets (from pysemgrep) *)
0 commit comments