Skip to content

Commit 37314fd

Browse files
authored
Include new app_blocking_match_based_ids field in ci_scan_complete_response (#326)
Right now whether or not a CI scan should exit with code 1 is determined _mostly_ by the CLI, but the app can use the `app_block_override` field of `ci_scan_complete_response` to tell the CLI to exit with code 1 no matter what. This is currently used to support blocking scans when we detect a dependency with a blocked license. We're currently working on a project which includes making it more customizable within the app whether or not a given finding should be blocking, right now just for supply chain, but with the aim to eventually move the computation of blocking findings entirely to the app. So we'd like to be able to tell the CLI not only "please block" but also "here are the list of findings that the app determined are blocking". - [x] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [x] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to *consume* data generated by Semgrep 1.50.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades Note that the types related to the semgrep-core JSON output or the semgrep-core RPC do not need to be backward compatible!
1 parent c992c98 commit 37314fd

7 files changed

+161
-4
lines changed

semgrep_output_v1.atd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ type uuid = string wrap <ocaml module="ATD_string_wrap.Uuidm">
100100
(* RFC 3339 format *)
101101
type datetime = string wrap <ocaml module="ATD_string_wrap.Datetime">
102102

103+
type match_based_id = string wrap
104+
103105
(*****************************************************************************)
104106
(* Versioning *)
105107
(*****************************************************************************)
@@ -1617,12 +1619,15 @@ type parsing_stats = {
16171619
num_bytes: int;
16181620
}
16191621

1622+
16201623
(* Response by the backend to the CLI to the POST /complete *)
16211624
type ci_scan_complete_response <ocaml attr="deriving show"> = {
16221625
success: bool;
16231626
~app_block_override: bool;
16241627
(* only when app_block_override is true *)
16251628
~app_block_reason: string;
1629+
(* match_based_ids of findings that semgrep-app determined should cause the scan to block *)
1630+
~app_blocking_match_based_ids : match_based_id list;
16261631
}
16271632

16281633
(* ----------------------------- *)

semgrep_output_v1.jsonschema

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.ts

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1_j.ml

Lines changed: 87 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1_j.mli

Lines changed: 24 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)