@aikidosec/firewall
Version:
Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.
14 lines (13 loc) • 588 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanError = cleanError;
const cleanupStackTrace_1 = require("./cleanupStackTrace");
const getLibraryRoot_1 = require("./getLibraryRoot");
// Cleans up the error stack trace by removing all the lines that are part of the library.
// e.g. useful to hide the module patching if we throw an error on a detected attack.
function cleanError(err) {
if (err.stack) {
err.stack = (0, cleanupStackTrace_1.cleanupStackTrace)(err.stack, (0, getLibraryRoot_1.getLibraryRoot)());
}
return err;
}