/
types.ts
184 lines (169 loc) · 4.61 KB
/
types.ts
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import { SupportedPackageManagers } from './package-managers';
import { IacProjectTypes } from './iac/iac-projects';
import { legacyCommon as legacyApi } from '@snyk/cli-interface';
import { SEVERITY } from './snyk-test/legacy';
import { FailOn } from './snyk-test/common';
export interface DepDict {
[name: string]: DepTree;
}
export type DepTree = legacyApi.DepTree;
export type ShowVulnPaths = 'none' | 'some' | 'all';
export interface TestOptions {
traverseNodeModules: boolean;
interactive: boolean;
pruneRepeatedSubdependencies?: boolean;
showVulnPaths: ShowVulnPaths;
failOn?: FailOn;
reachableVulns?: boolean;
reachableVulnsTimeout?: number;
yarnWorkspaces?: boolean;
testDepGraphDockerEndpoint?: string | null;
}
export interface WizardOptions {
newPolicy: boolean;
}
export interface Contributors {
userId: string;
lastCommitDate: string;
}
export interface PolicyOptions {
'ignore-policy'?: boolean; // used in snyk/policy lib
'trust-policies'?: boolean; // used in snyk/policy lib
'policy-path'?: string;
loose?: boolean;
}
export interface Options {
org?: string | null;
path: string;
docker?: boolean;
iac?: boolean;
file?: string;
policy?: string;
json?: boolean;
vulnEndpoint?: string;
projectName?: string;
insecure?: boolean;
'dry-run'?: boolean;
allSubProjects?: boolean;
'project-name'?: string;
'show-vulnerable-paths'?: string;
packageManager?: SupportedPackageManagers;
advertiseSubprojectsCount?: number;
projectNames?: string[];
severityThreshold?: SEVERITY;
dev?: boolean;
'print-deps'?: boolean;
'remote-repo-url'?: string;
scanAllUnmanaged?: boolean;
allProjects?: boolean;
detectionDepth?: number;
exclude?: string;
strictOutOfSync?: boolean;
// Used with the Docker plugin only. Allows requesting some experimental/unofficial features.
experimental?: boolean;
// Used with the Docker plugin only. Allows application scanning.
'app-vulns'?: boolean;
}
// TODO(kyegupov): catch accessing ['undefined-properties'] via noImplicitAny
export interface MonitorOptions {
id?: string;
docker?: boolean;
file?: string;
policy?: string;
json?: boolean;
allSubProjects?: boolean;
'project-name'?: string;
'print-deps'?: boolean;
'experimental-dep-graph'?: boolean;
scanAllUnmanaged?: boolean;
allProjects?: boolean;
// An experimental flag to allow monitoring of bigtrees (with degraded deps info and remediation advice).
pruneRepeatedSubdependencies?: boolean;
// Used with the Docker plugin only. Allows requesting some experimental/unofficial features.
experimental?: boolean;
// Used with the Docker plugin only. Allows application scanning.
'app-vulns'?: boolean;
reachableVulns?: boolean;
reachableVulnsTimeout?: number;
yarnWorkspaces?: boolean;
}
export interface MonitorMeta {
method: 'cli' | 'wizard';
packageManager: SupportedPackageManagers;
'policy-path': string;
'project-name': string;
isDocker: boolean;
prune: boolean;
'experimental-dep-graph'?: boolean;
'remote-repo-url'?: string;
}
export interface PackageJson {
scripts: any;
snyk: boolean;
dependencies: any;
devDependencies: any;
}
export interface MonitorResult {
org?: string;
id: string;
path: string;
licensesPolicy: any;
uri: string;
isMonitored: boolean;
trialStarted: boolean;
}
export interface SpinnerOptions {
stream?: NodeJS.WriteStream;
tty?: any;
string?: string;
interval?: any;
delay?: any;
label?: string;
unref?: any;
cleanup?: any;
}
export type SupportedProjectTypes = IacProjectTypes | SupportedPackageManagers;
// TODO: finish typing this there are many more!
export type SupportedUserReachableFacingCliArgs =
| 'severity-threshold'
| 'prune-repeated-subdependencies'
| 'ignore-policy'
| 'trust-policies'
| 'docker'
| 'file'
| 'policy'
| 'fail-on'
| 'json'
| 'package-manager'
| 'packages-folder'
| 'severity-threshold'
| 'strict-out-of-sync'
| 'all-sub-projects'
| 'sub-project'
| 'gradle-sub-project'
| 'skip-unresolved'
| 'scan-all-unmanaged'
| 'fail-on'
| 'all-projects'
| 'yarn-workspaces'
| 'detection-depth'
| 'project-name'
| 'reachable'
| 'reachable-vulns'
| 'reachable-timeout'
| 'reachable-vulns-timeout'
| 'integration-name'
| 'integration-version';
export enum SupportedCliCommands {
version = 'version',
help = 'help',
// config = 'config', // TODO: cleanup `$ snyk config` parsing logic before adding it here
// auth = 'auth', // TODO: auth does not support argv._ at the moment
test = 'test',
monitor = 'monitor',
protect = 'protect',
policy = 'policy',
ignore = 'ignore',
wizard = 'wizard',
woof = 'woof',
}