@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.
32 lines (31 loc) • 944 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMusl = isMusl;
/**
* Detects if the current process is running on a musl-based system (e.g. Alpine Linux).
* Based on the approach from the detect-libc package.
*/
function isMusl() {
var _a;
if (process.platform !== "linux") {
return false;
}
try {
const report = (_a = process.report) === null || _a === void 0 ? void 0 : _a.getReport();
if (!report) {
return false;
}
const header = report.header;
if (header && typeof header.glibcVersionRuntime === "string") {
return false;
}
const sharedObjects = report.sharedObjects;
if (Array.isArray(sharedObjects)) {
return sharedObjects.some((so) => so.includes("libc.musl-") || so.includes("ld-musl-"));
}
return false;
}
catch {
return false;
}
}