@nodesecure/scanner 8.1.0 → 8.2.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.
- package/dist/class/logger.class.d.ts +11 -1
- package/dist/class/logger.class.d.ts.map +1 -1
- package/dist/class/logger.class.js +1 -0
- package/dist/class/logger.class.js.map +1 -1
- package/dist/comparePayloads.d.ts +1 -1
- package/dist/depWalker.d.ts +2 -2
- package/dist/depWalker.js +188 -262
- package/dist/depWalker.js.map +1 -1
- package/dist/extractors/index.d.ts +2 -2
- package/dist/extractors/payload.d.ts +5 -5
- package/dist/extractors/payload.d.ts.map +1 -1
- package/dist/extractors/payload.js +1 -3
- package/dist/extractors/payload.js.map +1 -1
- package/dist/extractors/probes/ContactExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/ExtensionsExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/FlagsExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/FlagsExtractor.class.js +1 -1
- package/dist/extractors/probes/FlagsExtractor.class.js.map +1 -1
- package/dist/extractors/probes/LicensesExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/NodeDependenciesExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/SizeExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/VulnerabilitiesExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/WarningsExtractor.class.d.ts +2 -2
- package/dist/extractors/probes/index.d.ts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -73
- package/dist/index.js.map +1 -1
- package/dist/registry/NpmRegistryProvider.d.ts +6 -6
- package/dist/registry/PackumentExtractor.d.ts +1 -1
- package/dist/registry/RegistryTokenStore.d.ts +1 -1
- package/dist/registry/fetchNpmAvatars.d.ts +1 -1
- package/dist/utils/addMissingVersionFlags.d.ts +1 -1
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/isNodesecurePayload.d.ts +1 -1
- package/dist/utils/warnings.d.ts +1 -1
- package/package.json +3 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
export declare const ScannerLoggerEvents: {
|
|
3
|
+
readonly error: "error";
|
|
3
4
|
readonly done: "depWalkerFinished";
|
|
4
5
|
readonly analysis: {
|
|
5
6
|
readonly tree: "walkTree";
|
|
@@ -17,7 +18,16 @@ export interface LoggerEventData {
|
|
|
17
18
|
/** Count of triggered event */
|
|
18
19
|
count: number;
|
|
19
20
|
}
|
|
20
|
-
export
|
|
21
|
+
export type LoggerEventsMap = {
|
|
22
|
+
start: [eventName: string];
|
|
23
|
+
tick: [eventName: string];
|
|
24
|
+
end: [eventName: string, data: LoggerEventData & {
|
|
25
|
+
executionTime: number;
|
|
26
|
+
}];
|
|
27
|
+
depWalkerFinished: [];
|
|
28
|
+
error: [error: Error, phase?: string];
|
|
29
|
+
};
|
|
30
|
+
export declare class Logger extends EventEmitter<LoggerEventsMap> {
|
|
21
31
|
events: Map<string, LoggerEventData>;
|
|
22
32
|
start(eventName: string): this;
|
|
23
33
|
tick(eventName: string): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.class.d.ts","sourceRoot":"","sources":["../../src/class/logger.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"logger.class.d.ts","sourceRoot":"","sources":["../../src/class/logger.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAYtB,CAAC;AAEX,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1B,GAAG,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG;QAAE,aAAa,EAAE,MAAM,CAAC;KAAE,CAAC,CAAC;IAC7E,iBAAiB,EAAE,EAAE,CAAC;IACtB,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,qBAAa,MAAO,SAAQ,YAAY,CAAC,eAAe,CAAC;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAa;IAExD,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAc9B,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAW7B,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAa7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.class.js","sourceRoot":"","sources":["../../src/class/logger.class.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,UAAU;KACrB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,eAAe;KACvB;CACO,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.class.js","sourceRoot":"","sources":["../../src/class/logger.class.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC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ACnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE;YAC1B,GAAG,IAAI;YACP,aAAa,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS;SAClD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Warning } from "@nodesecure/js-x-ray";
|
|
2
2
|
import * as Vulnera from "@nodesecure/vulnera";
|
|
3
|
-
import type { Payload, Dependency, DependencyVersion, Publisher, Maintainer, Repository, DependencyLinks, GlobalWarning } from "./types.
|
|
3
|
+
import type { Payload, Dependency, DependencyVersion, Publisher, Maintainer, Repository, DependencyLinks, GlobalWarning } from "./types.ts";
|
|
4
4
|
export interface PayloadComparison {
|
|
5
5
|
title: string;
|
|
6
6
|
warnings: ArrayDiff<GlobalWarning>;
|
package/dist/depWalker.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ManifestVersion, PackageJSON, WorkspacesPackageJSON } from "@nodesecure/npm-types";
|
|
2
2
|
import type Config from "@npmcli/config";
|
|
3
|
-
import { Logger } from "./class/logger.class.
|
|
4
|
-
import type { Options, Payload } from "./types.
|
|
3
|
+
import { Logger } from "./class/logger.class.ts";
|
|
4
|
+
import type { Options, Payload } from "./types.ts";
|
|
5
5
|
type WalkerOptions = Omit<Options, "registry"> & {
|
|
6
6
|
registry: string;
|
|
7
7
|
location?: string;
|
package/dist/depWalker.js
CHANGED
|
@@ -1,55 +1,3 @@
|
|
|
1
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
-
if (value !== null && value !== void 0) {
|
|
3
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
-
var dispose, inner;
|
|
5
|
-
if (async) {
|
|
6
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
-
dispose = value[Symbol.asyncDispose];
|
|
8
|
-
}
|
|
9
|
-
if (dispose === void 0) {
|
|
10
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
-
dispose = value[Symbol.dispose];
|
|
12
|
-
if (async) inner = dispose;
|
|
13
|
-
}
|
|
14
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
-
}
|
|
18
|
-
else if (async) {
|
|
19
|
-
env.stack.push({ async: true });
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
-
return function (env) {
|
|
25
|
-
function fail(e) {
|
|
26
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
-
env.hasError = true;
|
|
28
|
-
}
|
|
29
|
-
var r, s = 0;
|
|
30
|
-
function next() {
|
|
31
|
-
while (r = env.stack.pop()) {
|
|
32
|
-
try {
|
|
33
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
-
if (r.dispose) {
|
|
35
|
-
var result = r.dispose.call(r.value);
|
|
36
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
-
}
|
|
38
|
-
else s |= 1;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
fail(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
-
if (env.hasError) throw env.error;
|
|
46
|
-
}
|
|
47
|
-
return next();
|
|
48
|
-
};
|
|
49
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
-
var e = new Error(message);
|
|
51
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
-
});
|
|
53
1
|
// Import Node.js Dependencies
|
|
54
2
|
import path from "node:path";
|
|
55
3
|
import { readFileSync } from "node:fs";
|
|
@@ -105,238 +53,216 @@ const kDefaultDependencyMetadata = {
|
|
|
105
53
|
const kRootDependencyId = 0;
|
|
106
54
|
const { version: packageVersion } = JSON.parse(readFileSync(new URL(path.join("..", "package.json"), import.meta.url), "utf-8"));
|
|
107
55
|
export async function depWalker(manifest, options, logger = new Logger()) {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
56
|
+
const { scanRootNode = false, includeDevDeps = false, packageLock, maxDepth, location, vulnerabilityStrategy = Vulnera.strategies.NONE, registry, npmRcConfig } = options;
|
|
57
|
+
const startedAt = Date.now();
|
|
58
|
+
const isRemoteScanning = typeof location === "undefined";
|
|
59
|
+
const tokenStore = new RegistryTokenStore(npmRcConfig, NPM_TOKEN.token);
|
|
60
|
+
await using tempDir = await TempDirectory.create();
|
|
61
|
+
const dependencyConfusionWarnings = [];
|
|
62
|
+
const payload = {
|
|
63
|
+
id: tempDir.id,
|
|
64
|
+
rootDependency: {
|
|
65
|
+
name: manifest.name ?? "workspace",
|
|
66
|
+
version: manifest.version ?? "0.0.0",
|
|
67
|
+
integrity: null
|
|
68
|
+
},
|
|
69
|
+
scannerVersion: packageVersion,
|
|
70
|
+
vulnerabilityStrategy,
|
|
71
|
+
warnings: [],
|
|
72
|
+
metadata: {
|
|
73
|
+
startedAt,
|
|
74
|
+
executionTime: 0
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const dependencies = new Map();
|
|
78
|
+
const npmTreeWalker = new npm.TreeWalker({
|
|
79
|
+
registry
|
|
80
|
+
});
|
|
81
|
+
{
|
|
82
|
+
logger
|
|
83
|
+
.start(ScannerLoggerEvents.analysis.tree)
|
|
84
|
+
.start(ScannerLoggerEvents.analysis.tarball)
|
|
85
|
+
.start(ScannerLoggerEvents.analysis.registry);
|
|
86
|
+
const fetchedMetadataPackages = new Set();
|
|
87
|
+
const operationsQueue = [];
|
|
88
|
+
const locker = new Mutex({ concurrency: 5 });
|
|
89
|
+
locker.on(MutexRelease, () => logger.tick(ScannerLoggerEvents.analysis.tarball));
|
|
90
|
+
const rootDepsOptions = {
|
|
91
|
+
maxDepth,
|
|
92
|
+
includeDevDeps,
|
|
93
|
+
packageLock
|
|
130
94
|
};
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.start(ScannerLoggerEvents.analysis.tarball)
|
|
139
|
-
.start(ScannerLoggerEvents.analysis.registry);
|
|
140
|
-
const fetchedMetadataPackages = new Set();
|
|
141
|
-
const operationsQueue = [];
|
|
142
|
-
const locker = new Mutex({ concurrency: 5 });
|
|
143
|
-
locker.on(MutexRelease, () => logger.tick(ScannerLoggerEvents.analysis.tarball));
|
|
144
|
-
const rootDepsOptions = {
|
|
145
|
-
maxDepth,
|
|
146
|
-
includeDevDeps,
|
|
147
|
-
packageLock
|
|
148
|
-
};
|
|
149
|
-
for await (const current of npmTreeWalker.walk(manifest, rootDepsOptions)) {
|
|
150
|
-
const { name, version, integrity, ...currentVersion } = current;
|
|
151
|
-
const dependency = {
|
|
152
|
-
versions: {
|
|
153
|
-
[version]: {
|
|
154
|
-
...currentVersion,
|
|
155
|
-
...structuredClone(kDefaultDependencyVersionFields)
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
vulnerabilities: [],
|
|
159
|
-
metadata: structuredClone(kDefaultDependencyMetadata)
|
|
160
|
-
};
|
|
161
|
-
let proceedDependencyScan = true;
|
|
162
|
-
const org = parseNpmSpec(name)?.org;
|
|
163
|
-
if (dependencies.has(name)) {
|
|
164
|
-
const dep = dependencies.get(name);
|
|
165
|
-
operationsQueue.push(new NpmRegistryProvider(name, version, {
|
|
166
|
-
registry,
|
|
167
|
-
tokenStore
|
|
168
|
-
}).enrichDependencyVersion(dep, dependencyConfusionWarnings, org));
|
|
169
|
-
if (version in dep.versions) {
|
|
170
|
-
// The dependency has already entered the analysis
|
|
171
|
-
// This happens if the package is used by multiple packages in the tree
|
|
172
|
-
proceedDependencyScan = false;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
dep.versions[version] = dependency.versions[version];
|
|
95
|
+
for await (const current of npmTreeWalker.walk(manifest, rootDepsOptions)) {
|
|
96
|
+
const { name, version, integrity, ...currentVersion } = current;
|
|
97
|
+
const dependency = {
|
|
98
|
+
versions: {
|
|
99
|
+
[version]: {
|
|
100
|
+
...currentVersion,
|
|
101
|
+
...structuredClone(kDefaultDependencyVersionFields)
|
|
176
102
|
}
|
|
103
|
+
},
|
|
104
|
+
vulnerabilities: [],
|
|
105
|
+
metadata: structuredClone(kDefaultDependencyMetadata)
|
|
106
|
+
};
|
|
107
|
+
let proceedDependencyScan = true;
|
|
108
|
+
const org = parseNpmSpec(name)?.org;
|
|
109
|
+
if (dependencies.has(name)) {
|
|
110
|
+
const dep = dependencies.get(name);
|
|
111
|
+
operationsQueue.push(new NpmRegistryProvider(name, version, {
|
|
112
|
+
registry,
|
|
113
|
+
tokenStore
|
|
114
|
+
}).enrichDependencyVersion(dep, dependencyConfusionWarnings, org));
|
|
115
|
+
if (version in dep.versions) {
|
|
116
|
+
// The dependency has already entered the analysis
|
|
117
|
+
// This happens if the package is used by multiple packages in the tree
|
|
118
|
+
proceedDependencyScan = false;
|
|
177
119
|
}
|
|
178
120
|
else {
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
const isRoot = current.id === kRootDependencyId;
|
|
182
|
-
if (isRoot && payload.rootDependency.integrity) {
|
|
183
|
-
payload.rootDependency.integrity = integrity;
|
|
121
|
+
dep.versions[version] = dependency.versions[version];
|
|
184
122
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
dependencies.set(name, dependency);
|
|
126
|
+
}
|
|
127
|
+
const isRoot = current.id === kRootDependencyId;
|
|
128
|
+
if (isRoot && payload.rootDependency.integrity) {
|
|
129
|
+
payload.rootDependency.integrity = integrity;
|
|
130
|
+
}
|
|
131
|
+
else if (isRoot) {
|
|
132
|
+
const isWorkspace = options.location && "workspaces" in manifest;
|
|
133
|
+
payload.rootDependency.integrity = isWorkspace ?
|
|
134
|
+
null :
|
|
135
|
+
fromData(JSON.stringify(manifest), { algorithms: ["sha512"] }).toString();
|
|
136
|
+
}
|
|
137
|
+
// If the dependency is a DevDependencies we ignore it.
|
|
138
|
+
if (current.isDevDependency || !proceedDependencyScan) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
logger.tick(ScannerLoggerEvents.analysis.tree);
|
|
142
|
+
// There is no need to fetch 'N' times the npm metadata for the same package.
|
|
143
|
+
if (fetchedMetadataPackages.has(name) || !current.existOnRemoteRegistry) {
|
|
144
|
+
logger.tick(ScannerLoggerEvents.analysis.registry);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
fetchedMetadataPackages.add(name);
|
|
148
|
+
const provider = new NpmRegistryProvider(name, version, {
|
|
149
|
+
registry,
|
|
150
|
+
tokenStore
|
|
151
|
+
});
|
|
152
|
+
operationsQueue.push(provider.enrichDependency(logger, dependency));
|
|
153
|
+
if (registry !== getNpmRegistryURL() && org) {
|
|
154
|
+
operationsQueue.push(new NpmRegistryProvider(name, version, {
|
|
203
155
|
registry,
|
|
204
156
|
tokenStore
|
|
205
|
-
});
|
|
206
|
-
operationsQueue.push(provider.enrichDependency(logger, dependency));
|
|
207
|
-
if (registry !== getNpmRegistryURL() && org) {
|
|
208
|
-
operationsQueue.push(new NpmRegistryProvider(name, version, {
|
|
209
|
-
registry,
|
|
210
|
-
tokenStore
|
|
211
|
-
}).enrichScopedDependencyConfusionWarnings(dependencyConfusionWarnings, org));
|
|
212
|
-
}
|
|
157
|
+
}).enrichScopedDependencyConfusionWarnings(dependencyConfusionWarnings, org));
|
|
213
158
|
}
|
|
214
|
-
const scanDirOptions = {
|
|
215
|
-
ref: dependency.versions[version],
|
|
216
|
-
location,
|
|
217
|
-
isRootNode: scanRootNode && name === manifest.name,
|
|
218
|
-
registry
|
|
219
|
-
};
|
|
220
|
-
operationsQueue.push(scanDirOrArchiveEx(name, version, locker, tempDir, scanDirOptions));
|
|
221
159
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const isVulnHydratable = (strategy === "github-advisory" || strategy === "snyk")
|
|
230
|
-
&& isRemoteScanning;
|
|
231
|
-
if (!isVulnHydratable) {
|
|
232
|
-
await hydratePayloadDependencies(dependencies, {
|
|
233
|
-
useStandardFormat: true,
|
|
234
|
-
path: location
|
|
235
|
-
});
|
|
160
|
+
const scanDirOptions = {
|
|
161
|
+
ref: dependency.versions[version],
|
|
162
|
+
location,
|
|
163
|
+
isRootNode: scanRootNode && name === manifest.name,
|
|
164
|
+
registry
|
|
165
|
+
};
|
|
166
|
+
operationsQueue.push(scanDirOrArchiveEx(name, version, locker, tempDir, logger, scanDirOptions));
|
|
236
167
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
168
|
+
logger.end(ScannerLoggerEvents.analysis.tree);
|
|
169
|
+
await Promise.allSettled(operationsQueue);
|
|
170
|
+
logger
|
|
171
|
+
.end(ScannerLoggerEvents.analysis.tarball)
|
|
172
|
+
.end(ScannerLoggerEvents.analysis.registry);
|
|
173
|
+
}
|
|
174
|
+
const { hydratePayloadDependencies, strategy } = Vulnera.setStrategy(vulnerabilityStrategy);
|
|
175
|
+
const isVulnHydratable = (strategy === "github-advisory" || strategy === "snyk")
|
|
176
|
+
&& isRemoteScanning;
|
|
177
|
+
if (!isVulnHydratable) {
|
|
178
|
+
await hydratePayloadDependencies(dependencies, {
|
|
179
|
+
useStandardFormat: true,
|
|
180
|
+
path: location
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
payload.vulnerabilityStrategy = strategy;
|
|
184
|
+
// We do this because it "seem" impossible to link all dependencies in the first walk.
|
|
185
|
+
// Because we are dealing with package only one time it may happen sometimes.
|
|
186
|
+
const globalWarnings = [];
|
|
187
|
+
for (const [packageName, dependency] of dependencies) {
|
|
188
|
+
const metadataIntegrities = dependency.metadata?.integrity ?? {};
|
|
189
|
+
for (const [version, integrity] of Object.entries(metadataIntegrities)) {
|
|
190
|
+
const dependencyVer = dependency.versions[version];
|
|
191
|
+
const isEmptyPackage = dependencyVer.warnings.some((warning) => warning.kind === "empty-package");
|
|
192
|
+
if (isEmptyPackage) {
|
|
193
|
+
globalWarnings.push({
|
|
194
|
+
type: "empty-package",
|
|
195
|
+
message: `${packageName}@${version} only contain a package.json file!`
|
|
196
|
+
});
|
|
261
197
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Object.assign(verDescriptor, {
|
|
271
|
-
author: parseAuthor(manifest.author),
|
|
272
|
-
links: getManifestLinks(manifest),
|
|
273
|
-
repository: manifest.repository
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
const usedDeps = npmTreeWalker.relationsMap.get(`${packageName}@${verStr}`) || new Set();
|
|
277
|
-
if (usedDeps.size === 0) {
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
const usedBy = Object.create(null);
|
|
281
|
-
for (const [name, version] of getUsedDeps(usedDeps)) {
|
|
282
|
-
usedBy[name] = version;
|
|
283
|
-
}
|
|
284
|
-
Object.assign(verDescriptor.usedBy, usedBy);
|
|
198
|
+
if (!("integrity" in dependencyVer) || dependencyVer.flags.includes("isGit")) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (dependencyVer.integrity !== integrity) {
|
|
202
|
+
globalWarnings.push({
|
|
203
|
+
type: "integrity-mismatch",
|
|
204
|
+
message: `${packageName}@${version} manifest & tarball integrity doesn't match!`
|
|
205
|
+
});
|
|
285
206
|
}
|
|
286
207
|
}
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
208
|
+
for (const version of Object.entries(dependency.versions)) {
|
|
209
|
+
const [verStr, verDescriptor] = version;
|
|
210
|
+
verDescriptor.flags.push(...addMissingVersionFlags(new Set(verDescriptor.flags), dependency));
|
|
211
|
+
if (isLocalManifest(verDescriptor, manifest, packageName)) {
|
|
212
|
+
Object.assign(dependency.metadata, {
|
|
213
|
+
author: parseAuthor(manifest.author),
|
|
214
|
+
homepage: manifest.homepage
|
|
215
|
+
});
|
|
216
|
+
Object.assign(verDescriptor, {
|
|
217
|
+
author: parseAuthor(manifest.author),
|
|
218
|
+
links: getManifestLinks(manifest),
|
|
219
|
+
repository: manifest.repository
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const usedDeps = npmTreeWalker.relationsMap.get(`${packageName}@${verStr}`) || new Set();
|
|
223
|
+
if (usedDeps.size === 0) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const usedBy = Object.create(null);
|
|
227
|
+
for (const [name, version] of getUsedDeps(usedDeps)) {
|
|
228
|
+
usedBy[name] = version;
|
|
229
|
+
}
|
|
230
|
+
Object.assign(verDescriptor.usedBy, usedBy);
|
|
299
231
|
}
|
|
300
232
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
233
|
+
try {
|
|
234
|
+
const { warnings, illuminated } = await getDependenciesWarnings(dependencies, options.highlight?.contacts, isRemoteScanning);
|
|
235
|
+
payload.warnings = globalWarnings.concat(dependencyConfusionWarnings).concat(warnings);
|
|
236
|
+
payload.highlighted = {
|
|
237
|
+
contacts: illuminated
|
|
238
|
+
};
|
|
239
|
+
payload.dependencies = Object.fromEntries(dependencies);
|
|
240
|
+
payload.metadata.executionTime = Date.now() - startedAt;
|
|
241
|
+
return payload;
|
|
304
242
|
}
|
|
305
243
|
finally {
|
|
306
|
-
|
|
307
|
-
if (result_1)
|
|
308
|
-
await result_1;
|
|
244
|
+
logger.emit(ScannerLoggerEvents.done);
|
|
309
245
|
}
|
|
310
246
|
}
|
|
311
247
|
// eslint-disable-next-line max-params
|
|
312
|
-
async function scanDirOrArchiveEx(name, version, locker, tempDir, options) {
|
|
313
|
-
|
|
248
|
+
async function scanDirOrArchiveEx(name, version, locker, tempDir, logger, options) {
|
|
249
|
+
using _ = await locker.acquire();
|
|
314
250
|
try {
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
catch {
|
|
331
|
-
// ignore
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
catch (e_2) {
|
|
335
|
-
env_2.error = e_2;
|
|
336
|
-
env_2.hasError = true;
|
|
251
|
+
const { registry, location = process.cwd(), isRootNode, ref } = options;
|
|
252
|
+
const mama = await (isRootNode ?
|
|
253
|
+
ManifestManager.fromPackageJSON(location) :
|
|
254
|
+
extractAndResolve(tempDir.location, {
|
|
255
|
+
spec: `${name}@${version}`,
|
|
256
|
+
registry
|
|
257
|
+
}));
|
|
258
|
+
await scanDirOrArchive(mama, ref, {
|
|
259
|
+
astAnalyserOptions: {
|
|
260
|
+
optionalWarnings: typeof location !== "undefined"
|
|
261
|
+
}
|
|
262
|
+
});
|
|
337
263
|
}
|
|
338
|
-
|
|
339
|
-
|
|
264
|
+
catch (error) {
|
|
265
|
+
logger.emit(ScannerLoggerEvents.error, error, "tarball-scan");
|
|
340
266
|
}
|
|
341
267
|
}
|
|
342
268
|
function isLocalManifest(verDescriptor, manifest, packageName) {
|
package/dist/depWalker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depWalker.js","sourceRoot":"","sources":["../src/depWalker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"depWalker.js","sourceRoot":"","sources":["../src/depWalker.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,kCAAkC;AAClC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB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@
|
|
|
1
|
-
import { Payload, type ProbeExtractor, type PackumentProbeExtractor, type ManifestProbeExtractor, type PackumentProbeNextCallback, type ManifestProbeNextCallback } from "./payload.
|
|
2
|
-
import * as Probes from "./probes/index.
|
|
1
|
+
import { Payload, type ProbeExtractor, type PackumentProbeExtractor, type ManifestProbeExtractor, type PackumentProbeNextCallback, type ManifestProbeNextCallback } from "./payload.ts";
|
|
2
|
+
import * as Probes from "./probes/index.ts";
|
|
3
3
|
export declare const Extractors: {
|
|
4
4
|
readonly Payload: typeof Payload;
|
|
5
5
|
readonly Callbacks: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Simplify } from "type-fest";
|
|
2
|
-
import
|
|
2
|
+
import type { Dependency, DependencyVersion, Payload as NodesecurePayload } from "../types.ts";
|
|
3
3
|
type MergeDeep<T extends unknown[]> = T extends [a: infer A, ...rest: infer R] ? A & MergeDeep<R> : {};
|
|
4
4
|
export type ExtractProbeResult<T extends ProbeExtractor<any>[]> = {
|
|
5
5
|
[K in keyof T]: T[K] extends ProbeExtractor<any> ? ReturnType<T[K]["done"]> : never;
|
|
@@ -8,10 +8,10 @@ export type MergedExtractProbeResult<T extends ProbeExtractor<any>[]> = Simplify
|
|
|
8
8
|
export type ProbeExtractorLevel = "packument" | "manifest";
|
|
9
9
|
export type ProbeExtractorManifestParent = {
|
|
10
10
|
name: string;
|
|
11
|
-
dependency:
|
|
11
|
+
dependency: Dependency;
|
|
12
12
|
};
|
|
13
|
-
export type PackumentProbeNextCallback = (name: string, dependency:
|
|
14
|
-
export type ManifestProbeNextCallback = (spec: string, dependencyVersion:
|
|
13
|
+
export type PackumentProbeNextCallback = (name: string, dependency: Dependency) => void;
|
|
14
|
+
export type ManifestProbeNextCallback = (spec: string, dependencyVersion: DependencyVersion, parent: ProbeExtractorManifestParent) => void;
|
|
15
15
|
export interface ProbeExtractor<Defs> {
|
|
16
16
|
level: ProbeExtractorLevel;
|
|
17
17
|
next(...args: any[]): void;
|
|
@@ -29,7 +29,7 @@ export declare class Payload<T extends ProbeExtractor<any>[]> extends EventTarge
|
|
|
29
29
|
private dependencies;
|
|
30
30
|
private probes;
|
|
31
31
|
private cachedResult;
|
|
32
|
-
constructor(data:
|
|
32
|
+
constructor(data: NodesecurePayload | NodesecurePayload["dependencies"], probes: [...T]);
|
|
33
33
|
extract(): ExtractProbeResult<T>;
|
|
34
34
|
extractAndMerge(): MergedExtractProbeResult<T>;
|
|
35
35
|
emit<T extends ProbeExtractorLevel>(event: T, ...extractionDetails: unknown[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/extractors/payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAK1C,OAAO,KAAK,OAAO,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/extractors/payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAK1C,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,OAAO,IAAI,iBAAiB,EAC7B,MAAM,aAAa,CAAC;AAMrB,KAAK,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,IAC9B,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAErE,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,cAAc,CAAC,GAAG,CAAC,EAAE,IAC7B;KACD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK;CACpF,CAAC;AACF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,CAAC,EAC3D,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IAchB,OAAO;IAyBP,eAAe,IAGG,wBAAwB,CAAC,CAAC,CAAC;IAG7C,IAAI,CAAC,CAAC,SAAS,mBAAmB,EAChC,KAAK,EAAE,CAAC,EACR,GAAG,iBAAiB,EAAE,OAAO,EAAE;IAQjC,EAAE,CAAC,CAAC,SAAS,mBAAmB,EAC9B,CAAC,EAAE,CAAC,EACJ,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC7B,IAAI;CASR;AAED,eAAO,MAAM,SAAS;mCAER,0BAA0B,KACnC,uBAAuB,CAAC,IAAI,CAAC;kCAQpB,yBAAyB,KAClC,sBAAsB,CAAC,IAAI,CAAC;CAOvB,CAAC;AAEX,KAAK,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,IAAI,UAAU,CAChE,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CACtB,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,mBAAmB,IAAI,UAAU,CAC7E,iBAAiB,CAAC,CAAC,CAAC,CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,IAAI,CAC7D,GAAG,MAAM,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KACzD,IAAI,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
import deepmerge from "@fastify/deepmerge";
|
|
3
|
-
|
|
4
|
-
import * as Scanner from "../types.js";
|
|
5
|
-
import { isNodesecurePayload } from "../utils/index.js";
|
|
3
|
+
import { isNodesecurePayload } from "../utils/isNodesecurePayload.js";
|
|
6
4
|
// CONSTANTS
|
|
7
5
|
const kFastMerge = deepmerge({ all: true });
|
|
8
6
|
export class Payload extends EventTarget {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../src/extractors/payload.ts"],"names":[],"mappings":"AAEA,aAAa;AACb,OAAO,SAAS,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../src/extractors/payload.ts"],"names":[],"mappings":"AAEA,aAAa;AACb,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAQ3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,YAAY;AACZ,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AA0C5C,MAAM,OAAO,OAAyC,SAAQ,WAAW;IAC/D,YAAY,CAAoC;IAChD,MAAM,CAAiC;IACvC,YAAY,CAAwB;IAE5C,YACE,IAA2D,EAC3D,MAAc;QAEd,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7C,IAAI,CAAC,YAAY,CAAC,CAAC;YACnB,IAAI,CAAC;QAEP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE9B,OAAO,IAAI,CAAC;QACd,CAAC,EAAE,EAAE,SAAS,EAAE,EAAkB,EAAE,QAAQ,EAAE,EAAkB,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;QAED,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YACnE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAA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CAAC,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAED,EAAE,CACA,CAAI,EACJ,QAA8B;QAE9B,SAAS,eAAe,CAAC,KAAY;YACnC,MAAM,WAAW,GAAG,KAAgD,CAAC;YACrE,QAAQ,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,CACP,QAAoC;QAEpC,OAAO;YACL,KAAK,EAAE,WAAoB;YAC3B,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IACD,QAAQ,CACN,QAAmC;QAEnC,OAAO;YACL,KAAK,EAAE,UAAmB;YAC1B,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;CACO,CAAC;AAcX,SAAS,IAAI;IACX,OAAO,KAAK,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestProbeExtractor, ProbeExtractorManifestParent } from "../payload.
|
|
2
|
-
import type { DependencyVersion } from "../../types.
|
|
1
|
+
import type { ManifestProbeExtractor, ProbeExtractorManifestParent } from "../payload.ts";
|
|
2
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
3
3
|
export type ContactsResult = {
|
|
4
4
|
contacts: Record<string, number>;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestProbeExtractor } from "../payload.
|
|
2
|
-
import type { DependencyVersion } from "../../types.
|
|
1
|
+
import type { ManifestProbeExtractor } from "../payload.ts";
|
|
2
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
3
3
|
export type ExtensionsResult = {
|
|
4
4
|
extensions: Record<string, number>;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestProbeExtractor } from "../payload.
|
|
2
|
-
import type { DependencyVersion } from "../../types.
|
|
1
|
+
import type { ManifestProbeExtractor } from "../payload.ts";
|
|
2
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
3
3
|
export type FlagsResult = {
|
|
4
4
|
flags: Record<string, number>;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlagsExtractor.class.js","sourceRoot":"","sources":["../../../src/extractors/probes/FlagsExtractor.class.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FlagsExtractor.class.js","sourceRoot":"","sources":["../../../src/extractors/probes/FlagsExtractor.class.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAYjD,YAAY;AACZ,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;AAEhC,MAAM,OAAO,KAAK;IAChB,KAAK,GAAG,UAAmB,CAAC;IAE5B,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAE5B,IAAI,CACF,CAAS,EACT,OAA0B;QAE1B,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACzB,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI;QACF,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;SACvC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestProbeExtractor } from "../payload.
|
|
2
|
-
import type { DependencyVersion } from "../../types.
|
|
1
|
+
import type { ManifestProbeExtractor } from "../payload.ts";
|
|
2
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
3
3
|
export type LicensesResult = {
|
|
4
4
|
licenses: Record<string, number>;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestProbeExtractor } from "../payload.
|
|
2
|
-
import type { DependencyVersion } from "../../types.
|
|
1
|
+
import type { ManifestProbeExtractor } from "../payload.ts";
|
|
2
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
3
3
|
export type NodeDependenciesResult = {
|
|
4
4
|
nodeDeps: string[];
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ManifestProbeExtractor, ProbeExtractorManifestParent } from "../payload.
|
|
2
|
-
import type { DependencyVersion } from "../../types.
|
|
1
|
+
import type { ManifestProbeExtractor, ProbeExtractorManifestParent } from "../payload.ts";
|
|
2
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
3
3
|
export type SizeResult = {
|
|
4
4
|
size: {
|
|
5
5
|
all: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StandardVulnerability } from "@nodesecure/vulnera";
|
|
2
|
-
import type { PackumentProbeExtractor } from "../payload.
|
|
3
|
-
import type { Dependency } from "../../types.
|
|
2
|
+
import type { PackumentProbeExtractor } from "../payload.ts";
|
|
3
|
+
import type { Dependency } from "../../types.ts";
|
|
4
4
|
export type VulnerabilitiesResult = {
|
|
5
5
|
vulnerabilities: StandardVulnerability[];
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Warning, WarningName } from "@nodesecure/js-x-ray";
|
|
2
|
-
import type { ManifestProbeExtractor, ProbeExtractorManifestParent } from "../payload.
|
|
3
|
-
import type { DependencyVersion } from "../../types.
|
|
2
|
+
import type { ManifestProbeExtractor, ProbeExtractorManifestParent } from "../payload.ts";
|
|
3
|
+
import type { DependencyVersion } from "../../types.ts";
|
|
4
4
|
export type WarningsResult = {
|
|
5
5
|
warnings: {
|
|
6
6
|
count: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./SizeExtractor.class.
|
|
2
|
-
export * from "./LicensesExtractor.class.
|
|
3
|
-
export * from "./ContactExtractor.class.
|
|
4
|
-
export * from "./WarningsExtractor.class.
|
|
5
|
-
export * from "./VulnerabilitiesExtractor.class.
|
|
6
|
-
export * from "./FlagsExtractor.class.
|
|
7
|
-
export * from "./ExtensionsExtractor.class.
|
|
8
|
-
export * from "./NodeDependenciesExtractor.class.
|
|
1
|
+
export * from "./SizeExtractor.class.ts";
|
|
2
|
+
export * from "./LicensesExtractor.class.ts";
|
|
3
|
+
export * from "./ContactExtractor.class.ts";
|
|
4
|
+
export * from "./WarningsExtractor.class.ts";
|
|
5
|
+
export * from "./VulnerabilitiesExtractor.class.ts";
|
|
6
|
+
export * from "./FlagsExtractor.class.ts";
|
|
7
|
+
export * from "./ExtensionsExtractor.class.ts";
|
|
8
|
+
export * from "./NodeDependenciesExtractor.class.ts";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as tarball from "@nodesecure/tarball";
|
|
2
2
|
import type Config from "@npmcli/config";
|
|
3
|
-
import { depWalker } from "./depWalker.
|
|
4
|
-
import { Logger, ScannerLoggerEvents } from "./class/logger.class.
|
|
5
|
-
import { comparePayloads } from "./comparePayloads.
|
|
6
|
-
import type { Options } from "./types.
|
|
7
|
-
export * from "./types.
|
|
8
|
-
export * from "./extractors/index.
|
|
3
|
+
import { depWalker } from "./depWalker.ts";
|
|
4
|
+
import { Logger, ScannerLoggerEvents } from "./class/logger.class.ts";
|
|
5
|
+
import { comparePayloads } from "./comparePayloads.ts";
|
|
6
|
+
import type { Options } from "./types.ts";
|
|
7
|
+
export * from "./types.ts";
|
|
8
|
+
export * from "./extractors/index.ts";
|
|
9
9
|
export type CwdOptions = Options & {
|
|
10
10
|
/**
|
|
11
11
|
* NPM runtime configuration (such as local .npmrc file)
|
|
@@ -13,9 +13,9 @@ export type CwdOptions = Options & {
|
|
|
13
13
|
*/
|
|
14
14
|
npmRcConfig?: Config;
|
|
15
15
|
};
|
|
16
|
-
export declare function cwd(location?: string, options?: CwdOptions, logger?: Logger): Promise<import("./types.
|
|
16
|
+
export declare function cwd(location?: string, options?: CwdOptions, logger?: Logger): Promise<import("./types.ts").Payload>;
|
|
17
17
|
export type FromOptions = Omit<Options, "includeDevDeps">;
|
|
18
|
-
export declare function from(packageName: string, options?: FromOptions, logger?: Logger): Promise<import("./types.
|
|
18
|
+
export declare function from(packageName: string, options?: FromOptions, logger?: Logger): Promise<import("./types.ts").Payload>;
|
|
19
19
|
export declare function verify(packageName?: string): Promise<tarball.ScannedPackageResult>;
|
|
20
20
|
export { depWalker, tarball, comparePayloads, Logger, ScannerLoggerEvents };
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,55 +1,3 @@
|
|
|
1
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
-
if (value !== null && value !== void 0) {
|
|
3
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
-
var dispose, inner;
|
|
5
|
-
if (async) {
|
|
6
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
-
dispose = value[Symbol.asyncDispose];
|
|
8
|
-
}
|
|
9
|
-
if (dispose === void 0) {
|
|
10
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
-
dispose = value[Symbol.dispose];
|
|
12
|
-
if (async) inner = dispose;
|
|
13
|
-
}
|
|
14
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
-
}
|
|
18
|
-
else if (async) {
|
|
19
|
-
env.stack.push({ async: true });
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
-
return function (env) {
|
|
25
|
-
function fail(e) {
|
|
26
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
-
env.hasError = true;
|
|
28
|
-
}
|
|
29
|
-
var r, s = 0;
|
|
30
|
-
function next() {
|
|
31
|
-
while (r = env.stack.pop()) {
|
|
32
|
-
try {
|
|
33
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
-
if (r.dispose) {
|
|
35
|
-
var result = r.dispose.call(r.value);
|
|
36
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
-
}
|
|
38
|
-
else s |= 1;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
fail(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
-
if (env.hasError) throw env.error;
|
|
46
|
-
}
|
|
47
|
-
return next();
|
|
48
|
-
};
|
|
49
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
-
var e = new Error(message);
|
|
51
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
-
});
|
|
53
1
|
// Import Node.js Dependencies
|
|
54
2
|
import path from "node:path";
|
|
55
3
|
import fs from "node:fs/promises";
|
|
@@ -103,28 +51,16 @@ export async function from(packageName, options = {}, logger = new Logger()) {
|
|
|
103
51
|
manifest, Object.assign(options, { registry }), logger);
|
|
104
52
|
}
|
|
105
53
|
export async function verify(packageName) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (typeof packageName === "undefined") {
|
|
109
|
-
return tarball.scanPackage(process.cwd());
|
|
110
|
-
}
|
|
111
|
-
const tempDir = __addDisposableResource(env_1, await TempDirectory.create(), true);
|
|
112
|
-
const mama = await tarball.extractAndResolve(tempDir.location, {
|
|
113
|
-
spec: packageName,
|
|
114
|
-
registry: getLocalRegistryURL()
|
|
115
|
-
});
|
|
116
|
-
const scanResult = await tarball.scanPackage(mama);
|
|
117
|
-
return scanResult;
|
|
118
|
-
}
|
|
119
|
-
catch (e_1) {
|
|
120
|
-
env_1.error = e_1;
|
|
121
|
-
env_1.hasError = true;
|
|
122
|
-
}
|
|
123
|
-
finally {
|
|
124
|
-
const result_1 = __disposeResources(env_1);
|
|
125
|
-
if (result_1)
|
|
126
|
-
await result_1;
|
|
54
|
+
if (typeof packageName === "undefined") {
|
|
55
|
+
return tarball.scanPackage(process.cwd());
|
|
127
56
|
}
|
|
57
|
+
await using tempDir = await TempDirectory.create();
|
|
58
|
+
const mama = await tarball.extractAndResolve(tempDir.location, {
|
|
59
|
+
spec: packageName,
|
|
60
|
+
registry: getLocalRegistryURL()
|
|
61
|
+
});
|
|
62
|
+
const scanResult = await tarball.scanPackage(mama);
|
|
63
|
+
return scanResult;
|
|
128
64
|
}
|
|
129
65
|
export { depWalker, tarball, comparePayloads, Logger, ScannerLoggerEvents };
|
|
130
66
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,M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C;IAC5C,CAAC;IAED,YAAY,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC;IAEnD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE;QAC7D,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,mBAAmB,EAAE;KAChC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEnD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,OAAO,EACL,SAAS,EACT,OAAO,EACP,eAAe,EACf,MAAM,EACN,mBAAmB,EACpB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as npmRegistrySDK from "@nodesecure/npm-registry-sdk";
|
|
2
2
|
import type { Packument, PackumentVersion, Signature } from "@nodesecure/npm-types";
|
|
3
|
-
import { type DateProvider } from "./PackumentExtractor.
|
|
4
|
-
import type { Dependency, DependencyConfusionWarning, TokenStore } from "../types.
|
|
5
|
-
import { Logger } from "../class/logger.class.
|
|
3
|
+
import { type DateProvider } from "./PackumentExtractor.ts";
|
|
4
|
+
import type { Dependency, DependencyConfusionWarning, TokenStore } from "../types.ts";
|
|
5
|
+
import { Logger } from "../class/logger.class.ts";
|
|
6
6
|
type PackumentNpmApiOptions = {
|
|
7
7
|
registry: string;
|
|
8
8
|
token?: string;
|
|
@@ -47,10 +47,10 @@ export declare class NpmRegistryProvider {
|
|
|
47
47
|
hasChangedAuthor: boolean;
|
|
48
48
|
hasManyPublishers: boolean;
|
|
49
49
|
hasReceivedUpdateInOneYear: boolean;
|
|
50
|
-
author: import("../types.
|
|
50
|
+
author: import("../types.ts").Maintainer | null;
|
|
51
51
|
homepage: string | null;
|
|
52
|
-
maintainers: import("../types.
|
|
53
|
-
publishers: import("../types.
|
|
52
|
+
maintainers: import("../types.ts").Maintainer[];
|
|
53
|
+
publishers: import("../types.ts").Publisher[];
|
|
54
54
|
integrity: Record<string, string>;
|
|
55
55
|
};
|
|
56
56
|
flags: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Config from "@npmcli/config";
|
|
2
|
-
import { type TokenStore } from "../types.
|
|
2
|
+
import { type TokenStore } from "../types.ts";
|
|
3
3
|
export declare class RegistryTokenStore implements TokenStore {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(config: Config | undefined, tokenFromEnv: string | undefined);
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from "./dirname.
|
|
2
|
-
export * from "./warnings.
|
|
3
|
-
export * from "./addMissingVersionFlags.
|
|
4
|
-
export * from "./getLinks.
|
|
5
|
-
export * from "./urlToString.
|
|
6
|
-
export * from "./getUsedDeps.
|
|
7
|
-
export * from "./isNodesecurePayload.
|
|
1
|
+
export * from "./dirname.ts";
|
|
2
|
+
export * from "./warnings.ts";
|
|
3
|
+
export * from "./addMissingVersionFlags.ts";
|
|
4
|
+
export * from "./getLinks.ts";
|
|
5
|
+
export * from "./urlToString.ts";
|
|
6
|
+
export * from "./getUsedDeps.ts";
|
|
7
|
+
export * from "./isNodesecurePayload.ts";
|
|
8
8
|
export declare const NPM_TOKEN: {
|
|
9
9
|
token: string;
|
|
10
10
|
} | {
|
package/dist/utils/warnings.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IlluminatedContact } from "@nodesecure/contact";
|
|
2
2
|
import type { Contact } from "@nodesecure/npm-types";
|
|
3
|
-
import type { Dependency, GlobalWarning } from "../types.
|
|
3
|
+
import type { Dependency, GlobalWarning } from "../types.ts";
|
|
4
4
|
export interface GetWarningsResult {
|
|
5
5
|
warnings: GlobalWarning[];
|
|
6
6
|
illuminated: IlluminatedContact[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodesecure/scanner",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "A package API to run a static analysis of your module's dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"lint": "eslint src test",
|
|
23
23
|
"prepublishOnly": "npm run build && pkg-ok",
|
|
24
24
|
"test": "c8 -r html npm run test-only && npm run test-types",
|
|
25
|
-
"test-only": "
|
|
25
|
+
"test-only": "node --test ./test/**/*.spec.ts",
|
|
26
26
|
"test-types": "attw --pack . --profile esm-only"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@nodesecure/npm-types": "^1.3.0",
|
|
69
69
|
"@nodesecure/rc": "^5.0.1",
|
|
70
70
|
"@nodesecure/tarball": "^2.3.0",
|
|
71
|
-
"@nodesecure/tree-walker": "^2.
|
|
71
|
+
"@nodesecure/tree-walker": "^2.1.0",
|
|
72
72
|
"@nodesecure/utils": "^2.3.0",
|
|
73
73
|
"@nodesecure/vulnera": "^2.0.1",
|
|
74
74
|
"@openally/mutex": "^2.0.0",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"@types/node": "^24.0.2",
|
|
85
85
|
"@types/npmcli__config": "^6.0.3",
|
|
86
86
|
"c8": "^10.1.3",
|
|
87
|
-
"tsx": "^4.19.4",
|
|
88
87
|
"typescript": "^5.8.3"
|
|
89
88
|
}
|
|
90
89
|
}
|