-
Notifications
You must be signed in to change notification settings - Fork 697
Expand file tree
/
Copy pathtypes.ts
More file actions
161 lines (136 loc) · 3.24 KB
/
Copy pathtypes.ts
File metadata and controls
161 lines (136 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import { DepGraphData } from '@snyk/dep-graph';
import { SEVERITY } from '../snyk-test/common';
import { RemediationChanges } from '../snyk-test/legacy';
import { Options, ProjectAttributes, Tag } from '../types';
export type Ecosystem = 'cpp' | 'docker';
export type FindingType = 'iacIssue';
export interface PluginResponse {
scanResults: ScanResult[];
analytics?: Analytics[];
}
export interface GitTarget {
remoteUrl?: string;
branch?: string;
}
export interface ContainerTarget {
image: string;
}
export interface NamedTarget extends GitTarget {
name: string; // Should be equal to the project name
}
export interface ScanResult {
identity: Identity;
facts: Facts[];
findings?: Finding[];
name?: string;
policy?: string;
target?: GitTarget | ContainerTarget | NamedTarget;
analytics?: Analytics[];
targetReference?: string;
}
export interface Analytics {
name: string;
data: unknown;
}
export interface Identity {
type: string;
targetFile?: string;
args?: { [key: string]: string };
}
export interface Facts {
type: string;
data: any;
}
export interface Finding {
type: FindingType;
data: any;
}
interface UpgradePathItem {
name: string;
version: string;
newVersion?: string;
isDropped?: boolean;
}
export interface UpgradePath {
path: UpgradePathItem[];
}
export interface FixInfo {
upgradePaths: UpgradePath[];
isPatchable: boolean;
nearestFixedInVersion?: string;
}
export interface Issue {
pkgName: string;
pkgVersion?: string;
issueId: string;
fixInfo: FixInfo;
}
export interface IssuesData {
[issueId: string]: {
id: string;
severity: SEVERITY;
title: string;
};
}
export interface DepsFilePaths {
[pkgKey: string]: string[];
}
export interface FileSignaturesDetails {
[pkgKey: string]: {
confidence: number;
filePaths: string[];
};
}
export interface TestResult {
issues: Issue[];
issuesData: IssuesData;
depGraphData: DepGraphData;
depsFilePaths?: DepsFilePaths;
fileSignaturesDetails?: FileSignaturesDetails;
remediation?: RemediationChanges;
}
export interface EcosystemPlugin {
scan: (options: Options) => Promise<PluginResponse>;
display: (
scanResults: ScanResult[],
testResults: TestResult[],
errors: string[],
options: Options,
) => Promise<string>;
test?: (
paths: string[],
options: Options,
) => Promise<{ readableResult: string; sarifResult?: string }>;
}
export interface EcosystemMonitorError {
error: string;
path: string;
scanResult: ScanResult;
}
export interface MonitorDependenciesResponse {
ok: boolean;
org: string;
id: string;
isMonitored: boolean;
licensesPolicy: any;
uri: string;
trialStarted: boolean;
path: string;
projectName: string;
}
export interface EcosystemMonitorResult extends MonitorDependenciesResponse {
scanResult: ScanResult;
}
export interface MonitorDependenciesRequest {
scanResult: ScanResult;
/**
* If provided, overrides the default project name (usually equivalent to the root package).
* @deprecated Must not be set by new code! Prefer to set the "scanResult.name" within your plugin!
*/
projectName?: string;
policy?: string;
method?: 'cli';
tags?: Tag[];
attributes?: ProjectAttributes;
pruneRepeatedSubdependencies?: boolean;
}