import { type LaunchEcosystem } from './launch-package.js'; import type { WardenGate, WardenGateInput, WardenGateResult } from './types.js'; /** * Known-malicious npm and PyPI packages, checked against a stdio server's launch line. * * `warden scan` and `warden-mcp wrap` start a stdio server to read its tools, and `npx -y` or * `uvx` runs the package's install scripts on the way. A package that is already known to be * malware has done its damage before any tool definition can be read, so this gate looks at the * launch line alone and runs before anything is started. * * The list ships inside the package (`dist/malware-list.tsv.gz`, built from `lists/malware-list.tsv`) * and is pinned by SHA-256 in `malware-list-pin.ts`, so the build digest that MOMUS signs covers * it. Nothing is fetched at run time. Two sources, treated differently: * * - **OpenSSF malicious-packages** (`ossf`): the OSV `MAL-` records that registries act on. * A match blocks: all versions, the version the launch pins, or a launch that does not pin * one while every version from some release on is listed. * - **OpenSourceMalware.com via the Vulnetix advisory database** (`osm`): reported, not * confirmed. Only records about packages OpenSSF does not list are kept, and a match is * advisory: on 2026-11-17, 27 of 40 sampled npm and 11 of 20 PyPI such packages were still * served by the registry. * * A list that is missing or does not match its pin is not used, and says so in * {@link MalwareList.bundledStatus}; it never blocks everything. */ export type MalwareSource = 'ossf' | 'osm'; export interface MalwareRange { /** First affected version; `0` means from the first release. */ from: string; /** End of the range, if any; `inclusive` for OSV `last_affected`, exclusive for `fixed`. */ to?: string; inclusive?: boolean; } export interface MalwareEntry { ecosystem: LaunchEcosystem; name: string; source: MalwareSource; /** Every version is affected. */ all: boolean; versions: string[]; ranges: MalwareRange[]; ids: string[]; } export interface MalwareListSource { id: MalwareSource; title: string; url: string; commit: string; date: string; } export interface MalwareListStatus { loaded: boolean; /** Why the list is not in use. */ reason?: string; sha256?: string; packages?: number; sources: MalwareListSource[]; } export type MalwareMatchKind = 'confirmed' | 'some-versions' | 'uncertain'; export interface MalwareMatch { entry: MalwareEntry; kind: MalwareMatchKind; } export declare class MalwareList { private readonly text; private readonly offsets; readonly sources: MalwareListSource[]; readonly sha256: string; private constructor(); /** Number of package lines (one per package and source). */ get size(): number; /** Parse a list. With `expectSha256`, refuse text whose digest differs. */ static fromText(text: string, opts?: { expectSha256?: string; }): MalwareList; /** The list shipped with this build, loaded once; undefined when it is missing or altered. */ static bundled(): MalwareList | undefined; static bundledStatus(): MalwareListStatus; status(): MalwareListStatus; private line; /** Every entry for this package, one per source. */ lookup(ecosystem: LaunchEcosystem, name: string): MalwareEntry[]; } /** What a report says about the list this build checks against. */ export type MalwareListRef = { packages: number; sha256: string; sources: Array<{ id: MalwareSource; commit: string; date: string; }>; } | { off: string; }; export declare function malwareListRef(): MalwareListRef; /** Short form for report headers: the date of the newest source, or why there is no list. */ export declare function malwareListLabel(ref: MalwareListRef | undefined): string; /** For tests: forget the loaded list. */ export declare function resetBundledMalwareList(): void; export declare function compareVersions(ecosystem: LaunchEcosystem, a: string, b: string): number | undefined; /** How a package, and the version a launch pins if it pins one, stands against one list entry. */ export declare function matchEntry(entry: MalwareEntry, version?: string): MalwareMatchKind | undefined; export declare function matchPackage(list: MalwareList, ecosystem: LaunchEcosystem, name: string, version?: string): MalwareMatch[]; /** * Blocks a stdio launch of a package OpenSSF lists as malicious; reports one that only * OpenSourceMalware.com lists, or whose listed versions the launch may or may not get. */ export declare class MalwareListGate implements WardenGate { private readonly list?; readonly name = "malware-list"; /** `list` undefined: the list shipped with this build. */ constructor(list?: MalwareList | undefined); evaluate(input: WardenGateInput): Promise; private evaluatePackage; } //# sourceMappingURL=malware-list.d.ts.map