@nodesecure/scanner 3.3.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,185 +1,193 @@
1
- // Import NodeSecure Dependencies
2
- import * as JSXRay from "@nodesecure/js-x-ray";
3
- import { license as License } from "@nodesecure/ntlp";
4
- import * as Vuln from "@nodesecure/vuln";
5
- import { Flags } from "@nodesecure/flags";
6
-
7
- // Import Third-party Dependencies
8
- import { Maintainer } from "@npm/types";
9
-
10
- export = Scanner;
11
-
12
- declare namespace Scanner {
13
- export interface Publisher {
14
- /**
15
- * Publisher npm user name.
16
- */
17
- name: string;
18
- /**
19
- * Publisher npm user email.
20
- */
21
- email: string;
22
- /**
23
- * First version published.
24
- */
25
- version: string;
26
- /**
27
- * Date of the first publication
28
- * @example 2021-08-10T20:45:08.342Z
29
- */
30
- at: string;
31
- }
32
-
33
- export interface DependencyVersion {
34
- /** Id of the package (useful for usedBy relation) */
35
- id: number;
36
- /** By whom (id) is used the package */
37
- usedBy: Record<string, string>;
38
- /** Size on disk of the extracted tarball (in bytes) */
39
- size: number;
40
- /** Package description */
41
- description: string;
42
- /** Author of the package. This information is not trustable and can be empty. */
43
- author: Maintainer;
44
- /**
45
- * JS-X-Ray warnings
46
- *
47
- * @see https://github.com/NodeSecure/js-x-ray/blob/master/WARNINGS.md
48
- */
49
- warnings: JSXRay.Warning<JSXRay.BaseWarning>[];
50
- /** Tarball composition (files and dependencies) */
51
- composition: {
52
- /** Files extensions (.js, .md, .exe etc..) */
53
- extensions: string[];
54
- files: string[];
55
- /** Minified files (foo.min.js etc..) */
56
- minified: string[];
57
- required_files: string[];
58
- required_thirdparty: string[];
59
- required_nodejs: string[];
60
- unused: string[];
61
- missing: string[];
62
- };
63
- /**
64
- * Package licenses with SPDX expression.
65
- *
66
- * @see https://github.com/NodeSecure/licenses-conformance
67
- * @see https://github.com/NodeSecure/npm-tarball-license-parser
68
- */
69
- license: License[];
70
- /**
71
- * Flags (Array of string)
72
- *
73
- * @see https://github.com/NodeSecure/flags/blob/main/FLAGS.md
74
- */
75
- flags: Flags[];
76
- /**
77
- * If the dependency is a GIT repository
78
- */
79
- gitUrl: null | string;
80
- }
81
-
82
- export interface Dependency {
83
- /** NPM Registry metadata */
84
- metadata: {
85
- /** Count of dependencies */
86
- dependencyCount: number;
87
- /** Number of releases published on npm */
88
- publishedCount: number;
89
- lastUpdateAt: number;
90
- /** Last version SemVer */
91
- lastVersion: number;
92
- hasChangedAuthor: boolean;
93
- hasManyPublishers: boolean;
94
- hasReceivedUpdateInOneYear: boolean;
95
- /** Author of the package. This information is not trustable and can be empty. */
96
- author: Maintainer;
97
- /** Package home page */
98
- homepage: string | null;
99
- /**
100
- * List of maintainers (list of people in the organization related to the package)
101
- */
102
- maintainers: { name: string, email: string }[];
103
- /**
104
- * List of people who published this package
105
- */
106
- publishers: Publisher[];
107
- }
108
- /** List of versions of this package available in the dependency tree (In the payload) */
109
- versions: Record<string, DependencyVersion>;
110
- /**
111
- * Vulnerabilities fetched dependending on the selected vulnerabilityStrategy
112
- *
113
- * @see https://github.com/NodeSecure/vuln
114
- */
115
- vulnerabilities: Vuln.Strategy.StandardVulnerability[];
116
- }
117
-
118
- export type GlobalWarning = string[];
119
- export type Dependencies = Record<string, Dependency>;
120
-
121
- export interface Payload {
122
- /** Payload unique id */
123
- id: string;
124
- /** Name of the analyzed package */
125
- rootDependencyName: string;
126
- /** Global warnings list */
127
- warnings: GlobalWarning[];
128
- /** All the dependencies of the package (flattened) */
129
- dependencies: Dependencies;
130
- /** Version of the scanner used to generate the result */
131
- scannerVersion: string;
132
- /** Vulnerability strategy name (npm, snyk, node) */
133
- vulnerabilityStrategy: Vuln.Strategy.Kind;
134
- }
135
-
136
- export interface VerifyPayload {
137
- files: {
138
- list: string[];
139
- extensions: string[];
140
- minified: string[];
141
- };
142
- directorySize: number;
143
- uniqueLicenseIds: string[];
144
- licenses: License[];
145
- ast: {
146
- dependencies: Record<string, JSXRay.Dependency>;
147
- warnings: JSXRay.Warning<JSXRay.BaseWarning>[];
148
- };
149
- }
150
-
151
- export interface Options {
152
- /**
153
- * Maximum tree depth
154
- *
155
- * @default 4
156
- */
157
- readonly maxDepth?: number;
158
- /**
159
- * Use root package-lock.json. This will have the effect of triggering the Arborist package.
160
- *
161
- * @default false for from() API
162
- * @default true for cwd() API
163
- */
164
- readonly usePackageLock?: boolean;
165
- /**
166
- * Vulnerability strategy name (npm, snyk, node)
167
- *
168
- * @default NONE
169
- */
170
- readonly vulnerabilityStrategy: Vuln.Strategy.Kind;
171
- /**
172
- * Analyze root package.
173
- *
174
- * @default false for from() API
175
- * @default true for cwd() API
176
- */
177
- readonly forceRootAnalysis?: boolean;
178
- /**
179
- * Deeper dependencies analysis with cwd() API.
180
- *
181
- * @default false
182
- */
183
- readonly fullLockMode?: boolean;
184
- }
185
- }
1
+ // Import NodeSecure Dependencies
2
+ import * as JSXRay from "@nodesecure/js-x-ray";
3
+ import { license as License } from "@nodesecure/ntlp";
4
+ import * as Vuln from "@nodesecure/vuln";
5
+ import { Flags } from "@nodesecure/flags";
6
+
7
+ // Import Third-party Dependencies
8
+ import { Maintainer } from "@npm/types";
9
+
10
+ export = Scanner;
11
+
12
+ declare namespace Scanner {
13
+ export interface Publisher {
14
+ /**
15
+ * Publisher npm user name.
16
+ */
17
+ name: string;
18
+ /**
19
+ * Publisher npm user email.
20
+ */
21
+ email: string;
22
+ /**
23
+ * First version published.
24
+ */
25
+ version: string;
26
+ /**
27
+ * Date of the first publication
28
+ * @example 2021-08-10T20:45:08.342Z
29
+ */
30
+ at: string;
31
+ }
32
+
33
+ export interface DependencyVersion {
34
+ /** Id of the package (useful for usedBy relation) */
35
+ id: number;
36
+ isDevDependency: boolean;
37
+ /** By whom (id) is used the package */
38
+ usedBy: Record<string, string>;
39
+ /** Size on disk of the extracted tarball (in bytes) */
40
+ size: number;
41
+ /** Package description */
42
+ description: string;
43
+ /** Author of the package. This information is not trustable and can be empty. */
44
+ author: Maintainer;
45
+ /**
46
+ * JS-X-Ray warnings
47
+ *
48
+ * @see https://github.com/NodeSecure/js-x-ray/blob/master/WARNINGS.md
49
+ */
50
+ warnings: JSXRay.Warning<JSXRay.BaseWarning>[];
51
+ /** Tarball composition (files and dependencies) */
52
+ composition: {
53
+ /** Files extensions (.js, .md, .exe etc..) */
54
+ extensions: string[];
55
+ files: string[];
56
+ /** Minified files (foo.min.js etc..) */
57
+ minified: string[];
58
+ required_files: string[];
59
+ required_thirdparty: string[];
60
+ required_nodejs: string[];
61
+ required_subpath: string[];
62
+ unused: string[];
63
+ missing: string[];
64
+ };
65
+ /**
66
+ * Package licenses with SPDX expression.
67
+ *
68
+ * @see https://github.com/NodeSecure/licenses-conformance
69
+ * @see https://github.com/NodeSecure/npm-tarball-license-parser
70
+ */
71
+ license: License[];
72
+ /**
73
+ * Flags (Array of string)
74
+ *
75
+ * @see https://github.com/NodeSecure/flags/blob/main/FLAGS.md
76
+ */
77
+ flags: Flags[];
78
+ /**
79
+ * If the dependency is a GIT repository
80
+ */
81
+ gitUrl: null | string;
82
+ }
83
+
84
+ export interface Dependency {
85
+ /** NPM Registry metadata */
86
+ metadata: {
87
+ /** Count of dependencies */
88
+ dependencyCount: number;
89
+ /** Number of releases published on npm */
90
+ publishedCount: number;
91
+ lastUpdateAt: number;
92
+ /** Last version SemVer */
93
+ lastVersion: number;
94
+ hasChangedAuthor: boolean;
95
+ hasManyPublishers: boolean;
96
+ hasReceivedUpdateInOneYear: boolean;
97
+ /** Author of the package. This information is not trustable and can be empty. */
98
+ author: Maintainer;
99
+ /** Package home page */
100
+ homepage: string | null;
101
+ /**
102
+ * List of maintainers (list of people in the organization related to the package)
103
+ */
104
+ maintainers: { name: string, email: string }[];
105
+ /**
106
+ * List of people who published this package
107
+ */
108
+ publishers: Publisher[];
109
+ }
110
+ /** List of versions of this package available in the dependency tree (In the payload) */
111
+ versions: Record<string, DependencyVersion>;
112
+ /**
113
+ * Vulnerabilities fetched dependending on the selected vulnerabilityStrategy
114
+ *
115
+ * @see https://github.com/NodeSecure/vuln
116
+ */
117
+ vulnerabilities: Vuln.Strategy.StandardVulnerability[];
118
+ }
119
+
120
+ export type GlobalWarning = string[];
121
+ export type Dependencies = Record<string, Dependency>;
122
+
123
+ export interface Payload {
124
+ /** Payload unique id */
125
+ id: string;
126
+ /** Name of the analyzed package */
127
+ rootDependencyName: string;
128
+ /** Global warnings list */
129
+ warnings: GlobalWarning[];
130
+ /** All the dependencies of the package (flattened) */
131
+ dependencies: Dependencies;
132
+ /** Version of the scanner used to generate the result */
133
+ scannerVersion: string;
134
+ /** Vulnerability strategy name (npm, snyk, node) */
135
+ vulnerabilityStrategy: Vuln.Strategy.Kind;
136
+ }
137
+
138
+ export interface VerifyPayload {
139
+ files: {
140
+ list: string[];
141
+ extensions: string[];
142
+ minified: string[];
143
+ };
144
+ directorySize: number;
145
+ uniqueLicenseIds: string[];
146
+ licenses: License[];
147
+ ast: {
148
+ dependencies: Record<string, JSXRay.Dependency>;
149
+ warnings: JSXRay.Warning<JSXRay.BaseWarning>[];
150
+ };
151
+ }
152
+
153
+ export interface Options {
154
+ /**
155
+ * Maximum tree depth
156
+ *
157
+ * @default 4
158
+ */
159
+ readonly maxDepth?: number;
160
+ /**
161
+ * Use root package-lock.json. This will have the effect of triggering the Arborist package.
162
+ *
163
+ * @default false for from() API
164
+ * @default true for cwd() API
165
+ */
166
+ readonly usePackageLock?: boolean;
167
+ /**
168
+ * Include project devDependencies (only available for cwd command)
169
+ *
170
+ * @default false
171
+ */
172
+ readonly includeDevDeps?: boolean;
173
+ /**
174
+ * Vulnerability strategy name (npm, snyk, node)
175
+ *
176
+ * @default NONE
177
+ */
178
+ readonly vulnerabilityStrategy: Vuln.Strategy.Kind;
179
+ /**
180
+ * Analyze root package.
181
+ *
182
+ * @default false for from() API
183
+ * @default true for cwd() API
184
+ */
185
+ readonly forceRootAnalysis?: boolean;
186
+ /**
187
+ * Deeper dependencies analysis with cwd() API.
188
+ *
189
+ * @default false
190
+ */
191
+ readonly fullLockMode?: boolean;
192
+ }
193
+ }