Move npm and pip mitm interception to separate files

This commit is contained in:
Sander Declerck 2025-11-07 10:10:27 +01:00
parent e251908cb3
commit f4694ba119
No known key found for this signature in database
8 changed files with 350 additions and 224 deletions

View file

@ -41,6 +41,22 @@ export function getAuditStats() {
return auditStats;
}
/**
*
* @param {string | undefined} name
* @param {string | undefined} version
* @returns {Promise<boolean>}
*/
export async function isMalwarePackage(name, version) {
if (!name || !version) {
return false;
}
const auditResult = await auditChanges([{ name, version, type: "add" }]);
return !auditResult.isAllowed;
}
/**
* @param {PackageChange[]} changes
*