governance.SEVERITIESconstno test imports itconst SEVERITIES: readonly ["critical", "high", "medium", "low", "info"]The severities, from the worst.
What a finding is, whichever tool found it: a rule, a title, a severity, the asset it is about and where on it, a description, a way to fix it, the weaknesses (CWE) and vulnerabilities (CVE) it names, a short redacted piece of evidence, and where it was read from. Its identity is the fingerprint of what makes it the same finding in the next report: the tool, the rule, the asset and the place (without its query), so that a retest recognizes it. The evidence is cut short and anything that looks like a credential in it is replaced, because a report holds what the tool saw, and the tool saw secrets.
import { SEVERITIES, redact } from "./model.ts";
SEVERITIES[0]; // "critical"
redact("Authorization: Bearer abc.def.ghi"); // "Authorization: [redacted]"governance.SEVERITIESconstno test imports itconst SEVERITIES: readonly ["critical", "high", "medium", "low", "info"]The severities, from the worst.
governance.Severitytypeno test imports ittype Severity = (typeof SEVERITIES)[number];A severity.
governance.Sourcetypeno test imports ittype Source = { readonly tool: string; readonly version?: string; readonly file: string };Where a finding was read from.
governance.RawFindingtypeno test imports ittype RawFinding = {
readonly rule: string;
readonly title: string;
readonly severity: Severity;
/** What it is a… (500 characters)type RawFinding = {
readonly rule: string;
readonly title: string;
readonly severity: Severity;
/** What it is about, as the report names it: a host, a URL's origin, a repository. */
readonly asset: string;
/** Where on the asset: a path, a port, a file and line. */
readonly location?: string;
readonly description: string;
readonly solution?: string;
readonly cwe: readonly string[];
readonly cve: readonly string[];
readonly evidence?: string;
readonly source: Source;
};A finding as a reader gives it, before it has an identity.
governance.Findingtypeno test imports ittype Finding = RawFinding & { readonly id: string };A finding.
governance.MAX_EVIDENCEconstno test imports itconst MAX_EVIDENCE: 500The most characters of evidence kept.
governance.redactfunctionno test imports itfunction redact(text: string): stringEvidence with what looks like a credential replaced and cut short: credentials in headers, assignments and long tokens.
governance.normalizeLocationfunctionno test imports itfunction normalizeLocation(location: string | undefined): stringThe place of a finding without what varies between runs: a URL without its query and fragment, a path as it is.
governance.fingerprintOffunctionno test imports itfunction fingerprintOf(f: Pick<RawFinding, "asset" | "location" | "rule" | "source">): Promise<string>The identity of a finding: the first 16 hexadecimal digits of the SHA-256 of the tool, the rule, the asset and the place.
governance.identifyfunctionno test imports itfunction identify(raw: readonly RawFinding[]): Promise<{ readonly findings: readonly Finding[]; readonly repeats: number; }>The findings with their identities. Two findings that make one identity are one: the first is kept and the count of the repeats is given.
governance.cweOffunctionno test imports itfunction cweOf(text: string | number | undefined): string | undefinedA weakness identifier as CWE-79, from a number or a text that holds one; nothing where there is none (0 and -1 are what tools write for none).
governance.cvesInfunctionno test imports itfunction cvesIn(text: string): readonly string[]The vulnerability identifiers in a text, as CVE-2024-12345, without repeats.
SEVERITIESconstconst SEVERITIES: readonly ["critical", "high", "medium", "low", "info"]The severities, from the worst.
Severitytypeno test imports ittype Severity = (typeof SEVERITIES)[number];A severity.
Sourcetypeno test imports ittype Source = { readonly tool: string; readonly version?: string; readonly file: string };Where a finding was read from.
RawFindingtypetype RawFinding = {
readonly rule: string;
readonly title: string;
readonly severity: Severity;
/** What it is a… (500 characters)type RawFinding = {
readonly rule: string;
readonly title: string;
readonly severity: Severity;
/** What it is about, as the report names it: a host, a URL's origin, a repository. */
readonly asset: string;
/** Where on the asset: a path, a port, a file and line. */
readonly location?: string;
readonly description: string;
readonly solution?: string;
readonly cwe: readonly string[];
readonly cve: readonly string[];
readonly evidence?: string;
readonly source: Source;
};A finding as a reader gives it, before it has an identity.
Findingtypetype Finding = RawFinding & { readonly id: string };A finding.
MAX_EVIDENCEconstconst MAX_EVIDENCE: 500The most characters of evidence kept.
redactfunctionfunction redact(text: string): stringEvidence with what looks like a credential replaced and cut short: credentials in headers, assignments and long tokens.
normalizeLocationfunctionfunction normalizeLocation(location: string | undefined): stringThe place of a finding without what varies between runs: a URL without its query and fragment, a path as it is.
fingerprintOffunctionfunction fingerprintOf(f: Pick<RawFinding, "asset" | "location" | "rule" | "source">): Promise<string>The identity of a finding: the first 16 hexadecimal digits of the SHA-256 of the tool, the rule, the asset and the place.
identifyfunctionfunction identify(raw: readonly RawFinding[]): Promise<{ readonly findings: readonly Finding[]; readonly repeats: number; }>The findings with their identities. Two findings that make one identity are one: the first is kept and the count of the repeats is given.
cweOffunctionfunction cweOf(text: string | number | undefined): string | undefinedA weakness identifier as CWE-79, from a number or a text that holds one; nothing where there is none (0 and -1 are what tools write for none).
cvesInfunctionfunction cvesIn(text: string): readonly string[]The vulnerability identifiers in a text, as CVE-2024-12345, without repeats.