mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Merge branch 'main' into feature/pypi-ci
This commit is contained in:
commit
35bd3dfb6f
20 changed files with 320 additions and 755 deletions
|
|
@ -18,6 +18,29 @@ import {
|
|||
* @property {boolean} isAllowed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} AuditStats
|
||||
* @property {number} totalPackages
|
||||
* @property {number} safePackages
|
||||
* @property {number} malwarePackages
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type AuditStats
|
||||
*/
|
||||
const auditStats = {
|
||||
totalPackages: 0,
|
||||
safePackages: 0,
|
||||
malwarePackages: 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {AuditStats}
|
||||
*/
|
||||
export function getAuditStats() {
|
||||
return auditStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {PackageChange[]} changes
|
||||
*
|
||||
|
|
@ -39,16 +62,20 @@ export async function auditChanges(changes) {
|
|||
);
|
||||
|
||||
if (malwarePackage) {
|
||||
auditStats.malwarePackages += 1;
|
||||
ui.writeVerbose(
|
||||
`Safe-chain: Package ${change.name}@${change.version} is marked as malware: ${malwarePackage.status}`
|
||||
);
|
||||
disallowedChanges.push({ ...change, reason: malwarePackage.status });
|
||||
} else {
|
||||
auditStats.safePackages += 1;
|
||||
ui.writeVerbose(
|
||||
`Safe-chain: Package ${change.name}@${change.version} is clean`
|
||||
);
|
||||
allowedChanges.push(change);
|
||||
}
|
||||
|
||||
auditStats.totalPackages += 1;
|
||||
}
|
||||
|
||||
const auditResults = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue