@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
128 lines • 3.64 kB
TypeScript
import type { ESTree } from "meriyah";
import { type SourceArrayLocation } from "./utils/toArrayLocation.ts";
export type OptionalWarningName = "synchronous-io" | "log-usage" | "insecure-random";
export type WarningName = "parsing-error" | "encoded-literal" | "unsafe-regex" | "unsafe-stmt" | "short-identifiers" | "suspicious-literal" | "suspicious-file" | "obfuscated-code" | "weak-crypto" | "shady-link" | "unsafe-command" | "unsafe-import" | "serialize-environment" | "data-exfiltration" | "sql-injection" | "monkey-patch" | "insecure-random" | "prototype-pollution" | OptionalWarningName;
export interface Warning<T = WarningName> {
kind: T | (string & {});
file?: string;
value: string | null;
source: string;
location: null | SourceArrayLocation | SourceArrayLocation[];
i18n: string;
severity: "Information" | "Warning" | "Critical";
experimental?: boolean;
}
export declare const warnings: Readonly<{
"parsing-error": {
i18n: string;
severity: "Information";
experimental: false;
};
"unsafe-import": {
i18n: string;
severity: "Warning";
experimental: false;
};
"unsafe-regex": {
i18n: string;
severity: "Warning";
experimental: false;
};
"unsafe-stmt": {
i18n: string;
severity: "Warning";
experimental: false;
};
"encoded-literal": {
i18n: string;
severity: "Information";
experimental: false;
};
"short-identifiers": {
i18n: string;
severity: "Warning";
experimental: false;
};
"suspicious-literal": {
i18n: string;
severity: "Warning";
experimental: false;
};
"suspicious-file": {
i18n: string;
severity: "Critical";
experimental: false;
};
"obfuscated-code": {
i18n: string;
severity: "Critical";
experimental: true;
};
"weak-crypto": {
i18n: string;
severity: "Information";
experimental: false;
};
"shady-link": {
i18n: string;
severity: "Warning";
experimental: false;
};
"unsafe-command": {
i18n: string;
severity: "Warning";
experimental: true;
};
"synchronous-io": {
i18n: string;
severity: "Warning";
experimental: true;
};
"serialize-environment": {
i18n: string;
severity: "Warning";
experimental: false;
};
"data-exfiltration": {
i18n: string;
severity: "Warning";
experimental: false;
};
"log-usage": {
i18n: string;
severity: "Information";
experimental: false;
};
"sql-injection": {
i18n: string;
severity: "Warning";
experimental: false;
};
"monkey-patch": {
i18n: string;
severity: "Warning";
experimental: false;
};
"insecure-random": {
i18n: string;
severity: "Information";
experimental: false;
};
"prototype-pollution": {
i18n: string;
severity: "Warning";
experimental: false;
};
}>;
export interface GenerateWarningOptions {
location?: ESTree.SourceLocation | null;
file?: string | null;
value: string | null;
source?: string;
/**
* Override the default severity level for this warning
*/
severity?: "Information" | "Warning" | "Critical";
}
export declare function generateWarning<T extends WarningName>(kind: T, options: GenerateWarningOptions): Warning<T>;
//# sourceMappingURL=warnings.d.ts.map