import type { McpServerRef, PinStore, ToolDef, WardenGate, WardenLogger, WardenPolicy, WardenVerdict } from "./types.js"; import { ThreatFeed } from "./threat-feed.js"; import { MalwareList } from "./malware-list.js"; import { type ClassifierInspection } from "./classifier.js"; export { StaticScanGate, staticScanRuleset, staticScanRulesetRef, STATIC_SCAN_RULESET_VERSION, } from "./static-scan.js"; export { inspectTools } from "./classifier.js"; export type { ClassifierOptions, ClassifierInspection, ClassifierFinding } from "./classifier.js"; export { PinningGate, canonicalToolsHash, tryCanonicalToolsHash, pinToolsHash, RFC8785_PIN_PREFIX, serverIdentityHash, UNCANONICAL_TOOLS_HASH } from "./pinning.js"; export { FilePinStore } from "./pin-store.js"; export { OriginGate } from "./origin.js"; export { ThreatFeed, ThreatGate, DEFAULT_FEED_MAX_AGE_MS, FEED_CLOCK_SKEW_MS } from "./threat-feed.js"; export { MalwareList, MalwareListGate, matchPackage, matchEntry, compareVersions } from "./malware-list.js"; export type { MalwareEntry, MalwareListSource, MalwareListStatus, MalwareMatch, MalwareMatchKind, MalwareRange, MalwareSource } from "./malware-list.js"; export { launchPackage } from "./launch-package.js"; export type { LaunchPackage, LaunchEcosystem } from "./launch-package.js"; export { EgressGuard, isSensitiveTool, classifyTools } from "./sandbox.js"; export { canonicalize, parseJsonStrict, CanonicalizationError, MAX_SAFE_JSON_INTEGER } from "./jcs.js"; export type { CanonicalizationCode } from "./jcs.js"; export type { StaticScanRule, StaticScanRuleset } from "./static-scan.js"; export type { ThreatFeedOptions } from "./threat-feed.js"; export { silentLogger } from "./logger.js"; export { displaySafe, DEFAULT_DISPLAY_MAX } from "./sanitize.js"; export { describeHintMoves, diffToolDefinitions, formatDefinitionDiff, hintMoves, wordDiff } from "./review-diff.js"; export { hintContradictions, hintContradictionFindings } from "./hint-claims.js"; export type { HintClaim, HintContradiction } from "./hint-claims.js"; export type { DefinitionDiff, ToolChange, FieldChange, HintMove, WordOp } from "./review-diff.js"; export { wildcardMatch } from "./glob.js"; export { checkAnswerConstraints } from "./flow-guard-constraints.js"; export { createAnswerGate } from "./answer-gate.js"; export type { AnswerGate, AnswerGateOptions, AnswerRule, AnswerRecord, AnswerScalar, AnswerCatalog, StructuredAnswer, AnswerGateCode, AnswerGateViolation, AnswerGateDecision, AnswerGateRequest, AnswerGateRunOptions, AnswerGateRunResult } from "./answer-gate.js"; export type { AnswerConstraintCheck, ConstraintEvidence, ConstraintViolation } from "./flow-guard-constraints.js"; export * from "./types.js"; export { Masker, MaskSession, MaskRefusal, parseMaskConfig, loadMaskConfig, withMaskNote, USER_ORIGIN } from "./mask.js"; export type { MaskConfig, MaskOverrides, MaskOrigin, MaskResult, RestoreResult, RestorePolicy, ClassPolicy } from "./mask.js"; export { PROFILES as MASK_PROFILES, PERSONAL_KINDS } from "./mask-detect.js"; export interface WardenInit { gates: WardenGate[]; policy: WardenPolicy; /** Where decisions are reported. Defaults to `silentLogger()`. */ log?: WardenLogger; } export interface WardenCreateDeps { /** Local complete inspection; clears only readable BASE64_BLOB / structured quotation ambiguity on identical tools. */ semanticReview?: ClassifierInspection; store: PinStore; policy: WardenPolicy; /** * The known-bad feed. Required, not defaulted: a `ThreatFeed` the host never * loaded still carries the built-in floor, but silently constructing one here * would hide from the host that no external intel is in play. */ threatFeed: ThreatFeed; /** * Known-malicious npm and PyPI packages, checked against a stdio launch line before * anything starts. Undefined: the list shipped with this build. `null`: no list. */ malwareList?: MalwareList | null; log?: WardenLogger; } /** * WARDEN — the MCP security firewall. * * Every MCP server is vetted through an ordered gate chain before its tools are * exposed to the agent: cheap static scanning first, then the known-bad threat * feed and the list of known-malicious npm and PyPI packages, then origin (declared by the operator, or offered by a remote catalog), * then drift/pinning. Findings accumulate across gates; the verdict is allow/block * plus a composite 0..1 safety score and a per-tool partition so a mostly-trusted * server can have one poisoned tool quarantined without severing the whole * connection. * * The score is WARDEN's OWN — the product of what each gate contributed, computed * from local facts. No reputation oracle is consulted and no socket is opened while * vetting. Slot three used to be a reputation gate that asked an oracle for a score * it had no data to compute; it is gone, and test/no-phantom-gate.test.ts fails if * anything like it comes back. */ export declare class Warden { private readonly gates; private readonly policy; private readonly log; constructor(init: WardenInit); /** * Guard against config typos that silently disable blocking, on a COPY. * * If `blockAtSeverity` isn't a valid Severity key, `SEVERITY_RANK[bad]` is * undefined and every comparison `number >= undefined` is false — zero blocks, * zero warnings — so the value is repaired. Repairing it in place used to write * into the host's own policy object, which is both a surprise (their config * silently changes under them, and any other Warden sharing the object sees it) * and a crash: `Object.freeze(policy)` is a reasonable thing for a host to do, * and assigning to a frozen property throws a TypeError out of the constructor * under ESM strict mode. A firewall that refuses to be constructed because the * config was immutable is not a firewall. */ private normalizePolicy; /** Build the standard gate chain: static → threat → known-malicious packages → origin → pinning. */ static create(deps: WardenCreateDeps): Warden; /** * Vet a server and its advertised tools. Runs every gate in order, short- * circuiting only on a fatal gate result. A connection is blocked if any gate * is fatal or any finding reaches policy.blockAtSeverity. */ vetLaunch(server: McpServerRef): Promise; vet(server: McpServerRef, tools: ToolDef[]): Promise; /** * Run one gate, converting a thrown error into a blocking finding. * * A gate that crashed did not clear the server, so the honest result is a * finding at `high` with a zero score — which blocks at the default threshold * and, under a report-only policy (`blockAtSeverity: "critical"`), is reported * without blocking, exactly like every other high-severity finding. * * Letting the exception escape instead was worse than it looks: `vet()` * rejected, so the host got no verdict at all — not the findings the earlier * gates had already produced, not the per-tool partition — and whether that * ended in a blocked connection or an unhandled rejection was up to the host. * A store with a full disk or a custom gate with a bug should not be able to * decide that. */ private runGate; /** * Record the user's approval: pin the current tool defs so future drift is * detected. Idempotent — re-approving just refreshes the snapshot. */ approve(server: McpServerRef, tools: ToolDef[], approvalMode?: "operator" | "automatic"): Promise; /** * A tool is blocked if a finding naming it reaches the block threshold. * Sensitive tools (per policy) stay allowed but are surfaced as flagged so the * agent loop can demand per-call approval at run time. */ private partitionTools; private sensitiveCount; } //# sourceMappingURL=index.d.ts.map