import { type MalwareListRef } from './malware-list.js'; import { type ClientKind, type ConfiguredServer, type DiscoveryEnv } from './scan-config.js'; import { type FetchedServer } from './mcp-client.js'; import { type HistorCheck } from './histor.js'; import { type ToxicFlow } from './toxic-flow.js'; import { type ClassifierOptions } from './classifier.js'; import { type ToolChange } from './scan-lock.js'; import type { Severity, ToolDef, WardenFinding, WardenPolicy, RulesetRef } from './types.js'; export declare const SEVERITIES: Severity[]; export interface ScanOptions { configs: string[]; project: boolean; clients?: ClientKind[]; cwd: string; launch: boolean; publicOnly: boolean; timeoutMs: number; concurrency: number; policy: WardenPolicy; lock?: string; updateLock: boolean; stateDir: string; feed?: string; feedKey?: string; histor: boolean; historUrl: string; /** Opt-in meaning-based check; absent unless both --classifier-url and --classifier-model are given. */ classifier?: ClassifierOptions & { blocks: boolean; }; format: 'table' | 'json'; sarif?: string; markdown?: string; jsonFile?: string; failOnError: boolean; color: boolean; } export type ServerStatus = 'scanned' | 'launch-only' | 'blocked-at-launch' | 'error' | 'skipped'; export interface HistorSummary { /** What was asked about: an endpoint, or a stdio server's `npm:`/`pypi:` package. */ package?: string; /** The package version HISTOR last observed in its sandbox. */ packageVersion?: string; /** HISTOR's id for the server: what its feed takes in `watch=`. */ targetId?: string; match?: string; note?: string; page?: string; unchangedSince?: string; changes?: number; /** The publisher declares the set you got in its registry entry (HISTOR did not observe it). */ declared?: { when?: string; registryVersion?: string; since?: string; source?: 'registry' | 'url'; url?: string; }; error?: string; notSent?: string; } export interface ScanServerResult { id: string; key: string; client: ClientKind; source: string; scope: 'user' | 'project'; transport: 'stdio' | 'sse' | 'http'; wrapped: boolean; /** Display form of the launch: secrets in args and URLs are redacted. */ launch: string; status: ServerStatus; allow: boolean | null; score?: number; decidedBy?: string; findings: WardenFinding[]; allowedTools: string[]; blockedTools: string[]; toolCount?: number; serverInfo?: { name?: string; version?: string; }; error?: string; skipped?: string; mtlDigest?: string; mtlError?: string; histor?: HistorSummary; classifier?: { model: string; flagged: number; error?: string; incompleteTools?: string[]; retried?: number; }; lock?: { state: 'match' | 'drift' | 'missing' | 'updated' | 'unchanged' | 'refused'; changes?: ToolChange[]; }; /** The fetched definitions; kept for the Markdown diff and --update-lock, not printed in JSON. */ tools?: ToolDef[]; } export interface ScanReport { tool: 'warden-scan'; version: string; scannedAt: string; ruleset: RulesetRef; /** The known-malicious package list stdio launch lines were checked against (malware-list.ts). */ malwareList?: MalwareListRef; policy: WardenPolicy; launch: boolean; sources: Array<{ path: string; client: ClientKind; scope: 'user' | 'project'; servers: number; error?: string; }>; servers: ScanServerResult[]; lock?: { path: string; stale: string[]; written: boolean; }; /** * Per client: private data, outside text and an outbound channel among the servers it starts * (toxic-flow.ts). Advisory: a flow never blocks and never changes the exit code. */ flows: ToxicFlow[]; /** With --histor: a feed of changes to the servers HISTOR knows among these, for any feed reader. */ historWatch?: string; /** * Without --histor: how many of these servers the HISTOR log could be asked about (a public address, * or a package from the public npm or PyPI registry). A count only: nothing was sent. */ historAvailable?: number; summary: { servers: number; scanned: number; allowed: number; blocked: number; errors: number; skipped: number; launchOnly: number; }; } export declare const SCAN_USAGE: string; export declare function parseScanArgs(argv: string[], env?: NodeJS.ProcessEnv): Promise; export declare class UsageRequested extends Error { constructor(); } /** A path segment or argument that looks like it carries a credential. */ export declare function looksSecret(text: string): boolean; /** The launch line with credentials replaced, for terminals, reports and SARIF. */ export declare function redactLaunch(server: ConfiguredServer): string; export declare function redactUrl(raw: string): string; /** The endpoint HISTOR may be asked about, or why it is not sent. */ export declare function historEndpoint(raw: string): { endpoint?: string; reason?: string; }; /** * The npm or PyPI package a stdio launch runs, as HISTOR names it (`npm:`, * `pypi:`), or why it is not sent. Only a package from the public * registry is named: a local path, a git or tarball URL, or a private registry * (`--registry`, `--index-url`) stays on this machine. The version is not sent — * the digest already tells HISTOR which of the versions it observed you run. */ export declare function historPackage(command: string, args: readonly string[]): { package?: string; reason?: string; }; /** * What HISTOR knows about a package beyond its tools: a name made to be taken for a popular one, * and the marks of a stolen publishing token on the version it observed. All advisory. */ export declare function packageFindings(answer: HistorCheck): WardenFinding[]; /** * What the package did in HISTOR's sandbox (gVisor's own trace, decoy credentials, canary tool * calls). Reading a decoy or writing where it would persist is the loud part; contacting its own * API during a call is what API servers do and is not a finding, nor is loading .env from the * working directory, which dotenv does for half the ecosystem. */ export declare function behaviourFindings(behaviour: Record | undefined, version: string): WardenFinding[]; export interface ScanDeps { fetch?: (server: ConfiguredServer, opts: ScanOptions) => Promise; historFetch?: typeof fetch; now?: () => Date; discovery?: Partial; } export declare function runScan(opts: ScanOptions, deps?: ScanDeps): Promise; export declare function exitCode(report: ScanReport, opts: Pick): number; //# sourceMappingURL=scan.d.ts.map