Skip to content

Commit f4df5f8

Browse files
authored
Merge pull request #176 from safedep/patch/extend-json-report-for-lfp-threats
feat: Add threat reporting support in JSON report schema
2 parents 578c2b4 + 31fa59b commit f4df5f8

9 files changed

Lines changed: 686 additions & 129 deletions

File tree

api/json_report_spec.proto

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,49 @@ message RemediationAdvice {
2222
string target_alternate_package_version = 6;
2323
}
2424

25+
// We are introducing the concept of Threat as a reporting entity so
26+
// that we can report threats like lockfile poisoning using a standard schema.
27+
// But why do we need threats? Why not just use vet's paradigm of policy over
28+
// enriched packages? The reason is, there are threats that are applicable in
29+
// an environment, against a manifest or other entities or even group of entities.
30+
// Hence it is required to introduce a threat as a reporting entity so that external
31+
// tools can consume vet's reports and take actions based on the threats.
32+
message ReportThreat {
33+
enum Confidence {
34+
UnknownConfidence = 0;
35+
36+
High = 1;
37+
Medium = 2;
38+
Low = 3;
39+
}
40+
41+
enum Source {
42+
UnknownSource = 0;
43+
44+
CWE = 1;
45+
}
46+
47+
enum Subject {
48+
UnknownSubject = 0;
49+
50+
Package = 1;
51+
Manifest = 2;
52+
}
53+
54+
string id = 1;
55+
string message = 2;
56+
Subject subject_type = 3;
57+
string subject = 4;
58+
Confidence confidence = 5;
59+
Source source = 6;
60+
string source_id = 7;
61+
}
62+
2563
message PackageManifestReport {
2664
string id = 1;
2765
Ecosystem ecosystem = 2;
2866
string path = 3;
67+
repeated ReportThreat threats = 4;
2968
}
3069

3170
// PackageReport represents the first class entity for which we have different type
@@ -42,6 +81,9 @@ message PackageReport {
4281
// Insights data
4382
repeated InsightVulnerability vulnerabilities = 5;
4483
repeated InsightLicenseInfo licenses = 6;
84+
85+
// Threats
86+
repeated ReportThreat threats = 7;
4587
}
4688

4789
message ReportMeta {

0 commit comments

Comments
 (0)