mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Merge branch 'main' into verbose-logging
This commit is contained in:
commit
be6a6dccd9
62 changed files with 1243 additions and 41 deletions
|
|
@ -4,6 +4,25 @@ import {
|
|||
openMalwareDatabase,
|
||||
} from "../malwareDatabase.js";
|
||||
|
||||
/**
|
||||
* @typedef {Object} PackageChange
|
||||
* @property {string} name
|
||||
* @property {string} version
|
||||
* @property {string} type
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} AuditResult
|
||||
* @property {PackageChange[]} allowedChanges
|
||||
* @property {(PackageChange & {reason: string})[]} disallowedChanges
|
||||
* @property {boolean} isAllowed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {PackageChange[]} changes
|
||||
*
|
||||
* @returns {Promise<AuditResult>}
|
||||
*/
|
||||
export async function auditChanges(changes) {
|
||||
const allowedChanges = [];
|
||||
const disallowedChanges = [];
|
||||
|
|
@ -41,6 +60,10 @@ export async function auditChanges(changes) {
|
|||
return auditResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{name: string, version: string, type: string}[]} changes
|
||||
* @returns {Promise<{name: string, version: string, status: string}[]>}
|
||||
*/
|
||||
async function getPackagesWithMalware(changes) {
|
||||
if (changes.length === 0) {
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue