mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Merge branch 'main' into feature/combine-certs
This commit is contained in:
commit
091e6ec5f8
18 changed files with 305 additions and 221 deletions
|
|
@ -64,8 +64,7 @@ export async function main(args) {
|
|||
|
||||
const auditStats = getAuditStats();
|
||||
if (auditStats.totalPackages > 0) {
|
||||
ui.emptyLine();
|
||||
ui.writeInformation(
|
||||
ui.writeVerbose(
|
||||
`${chalk.green("✔")} Safe-chain: Scanned ${
|
||||
auditStats.totalPackages
|
||||
} packages, no malware found.`
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ import { EventEmitter } from "events";
|
|||
* @property {(headers: NodeJS.Dict<string | string[]> | undefined) => NodeJS.Dict<string | string[]> | undefined} modifyRequestHeaders
|
||||
* @property {() => boolean} modifiesResponse
|
||||
* @property {(body: Buffer, headers: NodeJS.Dict<string | string[]> | undefined) => Buffer} modifyBody
|
||||
*
|
||||
* @typedef {Object} MalwareBlockedEvent
|
||||
* @property {string} packageName
|
||||
* @property {string} version
|
||||
* @property {string} targetUrl
|
||||
* @property {number} timestamp
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -140,9 +140,14 @@ function handleConnect(req, clientSocket, head) {
|
|||
|
||||
if (interceptor) {
|
||||
// Subscribe to malware blocked events
|
||||
interceptor.on("malwareBlocked", (event) => {
|
||||
onMalwareBlocked(event.packageName, event.version, event.url);
|
||||
});
|
||||
interceptor.on(
|
||||
"malwareBlocked",
|
||||
(
|
||||
/** @type {import("./interceptors/interceptorBuilder.js").MalwareBlockedEvent} */ event
|
||||
) => {
|
||||
onMalwareBlocked(event.packageName, event.version, event.targetUrl);
|
||||
}
|
||||
);
|
||||
|
||||
mitmConnect(req, clientSocket, interceptor);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue