@deepv-code/safe-npm 0.1.1 → 0.1.2
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/scanner/index.js
CHANGED
|
@@ -137,8 +137,12 @@ export async function scanPackage(packageName, options = {}, onProgress) {
|
|
|
137
137
|
if (issue.severity === 'fatal') {
|
|
138
138
|
riskLevel = 'fatal';
|
|
139
139
|
canBypass = false;
|
|
140
|
-
//
|
|
141
|
-
if (issue.
|
|
140
|
+
// Use explicit suggestion if available
|
|
141
|
+
if (issue.suggestion) {
|
|
142
|
+
suggestedPackage = issue.suggestion;
|
|
143
|
+
}
|
|
144
|
+
// Fallback: Try to extract from details (legacy/fallback)
|
|
145
|
+
else if (issue.type === 'typosquat' && issue.details?.includes('"')) {
|
|
142
146
|
const match = issue.details.match(/"([^"]+)"/);
|
|
143
147
|
if (match)
|
|
144
148
|
suggestedPackage = match[1];
|
package/dist/scanner/types.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export async function scanTyposquatting(packageName) {
|
|
|
88
88
|
severity: 'fatal',
|
|
89
89
|
message: t('typosquatDetected'),
|
|
90
90
|
details: `Similar to popular package "${popular}" (distance: ${distance})`,
|
|
91
|
+
suggestion: popular,
|
|
91
92
|
});
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
@@ -97,6 +98,7 @@ export async function scanTyposquatting(packageName) {
|
|
|
97
98
|
severity: 'fatal',
|
|
98
99
|
message: t('typosquatDetected'),
|
|
99
100
|
details: `Suspicious similarity to "${popular}"`,
|
|
101
|
+
suggestion: popular,
|
|
100
102
|
});
|
|
101
103
|
break;
|
|
102
104
|
}
|
|
@@ -116,6 +118,7 @@ export async function scanTyposquatting(packageName) {
|
|
|
116
118
|
severity: 'fatal',
|
|
117
119
|
message: t('typosquatDetected'),
|
|
118
120
|
details: `Scope Hijacking Detected: This package "${packageName}" mimics the official package "${popular}". Verify the scope carefully!`,
|
|
121
|
+
suggestion: popular,
|
|
119
122
|
});
|
|
120
123
|
break;
|
|
121
124
|
}
|