forged-cli 0.3.4 → 0.3.7
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/package.json +4 -3
- package/src/commands/scan.js +23 -0
- package/src/utils/trustedPublishers.js +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forged-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "A complete dev environment toolkit — shell, workflows, and project scaffolding in one install.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
],
|
|
13
13
|
"author": "Brandon <DevBrandon@icloud.com> (https://github.com/bkness)",
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"homepage": "https://
|
|
15
|
+
"homepage": "https://www.weballtech.com",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+ssh://git@github.com/bkness/forged-cli.git"
|
|
18
|
+
"url": "git+ssh://git@github.com/bkness/forged-cli.git",
|
|
19
|
+
"directory": "https//www.weballtech.com/manual.html"
|
|
19
20
|
},
|
|
20
21
|
"bugs": {
|
|
21
22
|
"url": "https://github.com/bkness/forged-cli/issues"
|
package/src/commands/scan.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, existsSync, readdirSync, statSync, writeFileSync } from 'fs';
|
|
2
2
|
import { createHash } from 'crypto';
|
|
3
3
|
import { join, basename } from 'path';
|
|
4
|
+
import { homedir } from 'os';
|
|
4
5
|
import { isSuspiciousName } from '../utils/levenshtein.js';
|
|
5
6
|
import { POPULAR_PACKAGES } from '../utils/popularPackages.js';
|
|
6
7
|
import { verifyTarballIntegrity } from '../utils/verifyIntegrity.js';
|
|
@@ -131,8 +132,14 @@ export async function scanCommand(cwd = process.cwd(), opts = {}) {
|
|
|
131
132
|
for (const name of Object.keys(deps)) {
|
|
132
133
|
if (popularSet.has(name)) continue;
|
|
133
134
|
for (const { known, distance } of isSuspiciousName(name, POPULAR_PACKAGES)) {
|
|
135
|
+
let resolvedVersion;
|
|
136
|
+
try {
|
|
137
|
+
const nmPkg = JSON.parse(readFileSync(join(cwd, 'node_modules', name, 'package.json'), 'utf8'));
|
|
138
|
+
resolvedVersion = nmPkg.version;
|
|
139
|
+
} catch {}
|
|
134
140
|
findings.warnings.push({
|
|
135
141
|
package: name,
|
|
142
|
+
version: resolvedVersion,
|
|
136
143
|
message: `${distance} character(s) from popular package "${known}" — possible typosquat`,
|
|
137
144
|
});
|
|
138
145
|
}
|
|
@@ -216,6 +223,22 @@ export async function scanCommand(cwd = process.cwd(), opts = {}) {
|
|
|
216
223
|
|
|
217
224
|
console.log(`${bold}Summary:${reset} ${findings.errors.length} error(s), ${findings.warnings.length} warning(s), ${findings.suppressed.length} suppressed\n`);
|
|
218
225
|
|
|
226
|
+
// Write local scan cache — dotfiles reads this to push telemetry
|
|
227
|
+
const flagged = [
|
|
228
|
+
...findings.errors.filter(f => f.package).map(f => f.package),
|
|
229
|
+
...findings.warnings.filter(f => f.package).map(f => f.package),
|
|
230
|
+
];
|
|
231
|
+
writeFileSync(
|
|
232
|
+
join(homedir(), '.forged-scan-cache.json'),
|
|
233
|
+
JSON.stringify({
|
|
234
|
+
safe: findings.errors.length === 0 && findings.warnings.length === 0,
|
|
235
|
+
packages: packagesVerified,
|
|
236
|
+
flagged,
|
|
237
|
+
checked_at: new Date().toISOString(),
|
|
238
|
+
}),
|
|
239
|
+
'utf8'
|
|
240
|
+
);
|
|
241
|
+
|
|
219
242
|
// Save report if requested
|
|
220
243
|
if (report) {
|
|
221
244
|
const reportData = {
|
|
@@ -36,13 +36,27 @@ export const TRUSTED_COMMUNITY = new Set([
|
|
|
36
36
|
// perfect-scrollbar current maintainer
|
|
37
37
|
'mattonit',
|
|
38
38
|
// Mapbox internal npm account rotation
|
|
39
|
-
'mapbox-npm-01', 'mapbox-npm-03',
|
|
39
|
+
'mapbox-npm-01', 'mapbox-npm-03', 'mbx-npm-02-production', 'mbx-npm-03-production',
|
|
40
40
|
// Prettier automated release bot (replaced fisker)
|
|
41
41
|
'prettier-bot',
|
|
42
42
|
// Sequelize current maintainer (replaced sdepold, original creator)
|
|
43
43
|
'wikirik',
|
|
44
44
|
// Meta/React Native core team (replaced zertosh on v8-compile-cache)
|
|
45
45
|
'yungsters',
|
|
46
|
+
// cosmiconfig new maintainer (replaced davidtheclark)
|
|
47
|
+
'd-fischer',
|
|
48
|
+
// find-root: jden renamed their npm account
|
|
49
|
+
'jsdnxx',
|
|
50
|
+
// Express.js core team (replaced ulisesgascon on express@5)
|
|
51
|
+
'jonchurch',
|
|
52
|
+
// source-map maintainer, Mozilla engineer (replaced nickfitzgerald)
|
|
53
|
+
'tromey',
|
|
54
|
+
// async: long-standing transfer from aearly
|
|
55
|
+
'hargasinski',
|
|
56
|
+
// http-proxy: known contributor, took over from indexzero
|
|
57
|
+
'jcrugzz',
|
|
58
|
+
// prebuild-install: known npm ecosystem contributor, took over from lovell
|
|
59
|
+
'vweevers',
|
|
46
60
|
]);
|
|
47
61
|
|
|
48
62
|
export function classifyPublisherChange(from, to) {
|