@shieldaai/security-watch 1.2.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/CONTRIBUTING.md +2 -0
  3. package/README.md +69 -42
  4. package/SECURITY.md +4 -1
  5. package/dist/check.d.ts +193 -0
  6. package/dist/check.js +1000 -0
  7. package/dist/cli.js +301 -6
  8. package/dist/config.d.ts +22 -0
  9. package/dist/config.js +32 -0
  10. package/dist/cve-now.js +2 -0
  11. package/dist/delivery.js +30 -0
  12. package/dist/engine.d.ts +25 -0
  13. package/dist/engine.js +64 -4
  14. package/dist/index.d.ts +8 -1
  15. package/dist/index.js +3 -0
  16. package/dist/inventory.d.ts +2 -1
  17. package/dist/inventory.js +2 -3
  18. package/dist/manifests.d.ts +7 -0
  19. package/dist/manifests.js +16 -0
  20. package/dist/mcp-server.d.ts +256 -0
  21. package/dist/mcp-server.js +755 -0
  22. package/dist/mitigations.d.ts +137 -0
  23. package/dist/mitigations.js +426 -0
  24. package/dist/rehearsal.d.ts +25 -0
  25. package/dist/rehearsal.js +2 -0
  26. package/dist/sbom.d.ts +12 -1
  27. package/dist/sbom.js +37 -7
  28. package/dist/shield-candidates.d.ts +97 -0
  29. package/dist/shield-candidates.js +251 -0
  30. package/dist/shield-inputs.d.ts +49 -0
  31. package/dist/shield-inputs.js +297 -0
  32. package/dist/shirudo-sboms.d.ts +62 -0
  33. package/dist/shirudo-sboms.js +598 -0
  34. package/dist/sources.d.ts +2 -0
  35. package/dist/sources.js +14 -0
  36. package/dist/store.js +6 -4
  37. package/dist/types.d.ts +31 -0
  38. package/dist/vex.d.ts +62 -0
  39. package/dist/vex.js +246 -0
  40. package/docs/agents.md +139 -0
  41. package/docs/configuration.md +20 -1
  42. package/docs/mitigations.md +139 -0
  43. package/docs/offline-advisory-preview.md +2 -2
  44. package/docs/sbom.md +4 -4
  45. package/docs/shirudo.md +113 -0
  46. package/npm-shrinkwrap.json +237 -0
  47. package/package.json +10 -5
package/dist/engine.js CHANGED
@@ -4,6 +4,8 @@ import { cvssV4BaseScore } from './cvss4.js';
4
4
  import { assess, decide } from './assessment.js';
5
5
  import { collectSources } from './sources.js';
6
6
  import { attachEpss, findingCves, readEpssCache, refreshEpss } from './epss.js';
7
+ import { evidenceContent } from './shield-inputs.js';
8
+ import { attachMitigations, exportProblems, MitigationIndex, readMitigationExport, unmatchedSystems, } from './mitigations.js';
7
9
  import { attachLocation, attachRemediation, compareInventories } from './inventory-evidence.js';
8
10
  import { ModelAnalyzer, PROMPT_VERSION } from './models.js';
9
11
  import { Store } from './store.js';
@@ -58,6 +60,38 @@ export const evidenceSchema = z
58
60
  withdrawn: z.boolean().optional(),
59
61
  exploited: z.boolean().optional(),
60
62
  malware: z.boolean().optional(),
63
+ references: z
64
+ .array(z.strictObject({
65
+ type: z.enum([
66
+ 'fix',
67
+ 'evidence',
68
+ 'advisory',
69
+ 'report',
70
+ 'detection',
71
+ 'introduced',
72
+ 'package',
73
+ 'source',
74
+ 'web',
75
+ ]),
76
+ url: z.url({ protocol: /^https$/ }).max(2048),
77
+ }))
78
+ .max(40)
79
+ .optional(),
80
+ fix_commits: z
81
+ .array(z.strictObject({
82
+ repo: z.url({ protocol: /^https$/ }).max(2048),
83
+ commit: z.string().regex(/^[0-9a-f]{7,64}$/),
84
+ }))
85
+ .max(20)
86
+ .optional(),
87
+ weaknesses: z
88
+ .array(z.string().regex(/^CWE-\d{1,5}$/))
89
+ .max(20)
90
+ .optional(),
91
+ exploit_sources: z
92
+ .array(z.enum(['exploit-db', 'metasploit', 'nuclei', 'github-poc']))
93
+ .max(4)
94
+ .optional(),
61
95
  })
62
96
  .strict();
63
97
  export function readFixture(path) {
@@ -148,8 +182,32 @@ export async function runScan(options) {
148
182
  // its revision and review: a score that changes daily must not re-send, reopen or re-analyse.
149
183
  let epssCache = config.sources.epss ? readEpssCache(store.getMeta('epss:cache')) : {};
150
184
  let epssEvidence = new Map(remediationEvidence.map((item) => [item.id, item]));
185
+ // Runtime mitigation status is read from the operator's export files and, like EPSS, is shown only.
186
+ const mitigationProblems = [];
187
+ const mitigationIndexes = [];
188
+ for (const source of config.mitigations ?? [])
189
+ try {
190
+ const exported = readMitigationExport(source, now);
191
+ mitigationIndexes.push(new MitigationIndex(exported, source));
192
+ const messages = exportProblems(exported, source, now);
193
+ // Rows that all miss the inventory are a mapping mistake (an image watched under another
194
+ // system ID, a typo in systems:), not a fleet without findings.
195
+ const missed = unmatchedSystems(exported, source, new Set(inventory.systems.map((system) => system.id)));
196
+ if (exported.rows.length && missed.length === new Set(exported.rows.map((row) => row.system)).size)
197
+ messages.push(`${source.name}: no system key in the export is a system in the inventory (${missed.slice(0, 5).join(', ')}${missed.length > 5 ? ', …' : ''}); map them with systems: or watch those systems.`);
198
+ for (const message of messages)
199
+ mitigationProblems.push({ source: `mitigations:${source.name}`, message });
200
+ }
201
+ catch (error) {
202
+ mitigationProblems.push({
203
+ source: `mitigations:${source.name}`,
204
+ message: `${source.name}: the export could not be read, so its mitigation status is not shown: ${error.code === 'ENOENT'
205
+ ? 'the file does not exist'
206
+ : error.message}.`,
207
+ });
208
+ }
151
209
  const persist = (assessment) => {
152
- assessment = attachEpss(attachLocation(attachRemediation(assessment, inventory, remediationEvidence, config, now), inventory), epssCache, findingCves(assessment, epssEvidence));
210
+ assessment = attachMitigations(attachEpss(attachLocation(attachRemediation(assessment, inventory, remediationEvidence, config, now), inventory), epssCache, findingCves(assessment, epssEvidence)), mitigationIndexes, epssEvidence, inventory);
153
211
  const decision = decide(assessment, config);
154
212
  decisions[assessment.id] = decision;
155
213
  store.saveAssessment(assessment, decision, now, config.digest_interval_hours * 3_600_000, decision.review
@@ -161,8 +219,8 @@ export async function runScan(options) {
161
219
  : undefined);
162
220
  };
163
221
  const retire = (previous) => {
164
- // A retired finding is not looked up any more; an ageing score would only mislead.
165
- const { epss: _epss, ...assessment } = previous;
222
+ // A retired finding is not looked up any more; an ageing score or shield status would only mislead.
223
+ const { epss: _epss, mitigations: _mitigations, ...assessment } = previous;
166
224
  store.saveAssessment({
167
225
  ...assessment,
168
226
  active: false,
@@ -204,7 +262,8 @@ export async function runScan(options) {
204
262
  const item = evidenceById.get(id);
205
263
  if (!item)
206
264
  return null;
207
- const { fetched_at: _fetched, ...content } = item;
265
+ // Shield inputs (links, commits, weaknesses) are never analysed, so they never ask for analysis.
266
+ const content = evidenceContent(item);
208
267
  const fetched = Date.parse(item.fetched_at);
209
268
  return {
210
269
  ...content,
@@ -296,6 +355,7 @@ export async function runScan(options) {
296
355
  ...result.errors,
297
356
  ...(inventory.import_warnings ?? []).map((message) => ({ source: 'inventory:sbom', message })),
298
357
  ];
358
+ errors.push(...mitigationProblems);
299
359
  const notices = [...(inventory.name_notices ?? [])];
300
360
  if (!options.fixture && missingCredentials(config).length)
301
361
  errors.push({
package/dist/index.d.ts CHANGED
@@ -1,4 +1,11 @@
1
- export type { Severity, Category, Applicability, Channel, Provenance, DeploymentObservation, ArtifactKind, DeclaredVerification, DependencyLink, DependencyRelationship, DeclaredRemediation, InventoryEvidence, Component, Product, FindingLocation, System, Inventory, PackageClaim, CvssV4BaseScore, Evidence, ModelSpec, Config, Rule, Assessment, AiReviewReason, AiReview, Decision, Notification, HttpOptions, HttpResult, HttpClient, CoverageReceipt, InventoryDrift, RemediationEvidence, SourceResult, AiAnalysis, NewsAnalysis, NewsSignals, NewsStatement, EpssScore, } from './types.js';
1
+ export type { Severity, Category, Applicability, Channel, Provenance, DeploymentObservation, ArtifactKind, DeclaredVerification, DependencyLink, DependencyRelationship, DeclaredRemediation, InventoryEvidence, Component, Product, FindingLocation, System, Inventory, PackageClaim, CvssV4BaseScore, Evidence, ModelSpec, Config, Rule, Assessment, AiReviewReason, AiReview, Decision, Notification, HttpOptions, HttpResult, HttpClient, CoverageReceipt, InventoryDrift, RemediationEvidence, SourceResult, AiAnalysis, NewsAnalysis, NewsSignals, NewsStatement, EpssScore, AdvisoryReference, FixCommit, ReferenceType, } from './types.js';
2
+ export { shieldCandidates } from './shield-candidates.js';
3
+ export type { ShieldCandidate, ShieldCandidateReport, ShieldCandidateInput, ShieldReadiness, FindingControls, } from './shield-candidates.js';
4
+ export type { MitigationStatus, MitigationState, MitigationSource, MitigationFormat } from './mitigations.js';
5
+ export { openVex } from './vex.js';
6
+ export type { VexInput, VexDocument, VexStatement } from './vex.js';
7
+ export { syncShirudoSboms } from './shirudo-sboms.js';
8
+ export type { ShirudoSyncOptions, ShirudoSyncPlan, ShirudoSyncImage } from './shirudo-sboms.js';
2
9
  export { scorePilotResponses, type PilotResponseRegister, type PilotResponseScore, } from './pilot-responses.js';
3
10
  export { loadConfig, parseConfig, configSchema } from './config.js';
4
11
  export { loadInventory } from './inventory.js';
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ export { shieldCandidates } from './shield-candidates.js';
2
+ export { openVex } from './vex.js';
3
+ export { syncShirudoSboms } from './shirudo-sboms.js';
1
4
  export { scorePilotResponses, } from './pilot-responses.js';
2
5
  export { loadConfig, parseConfig, configSchema } from './config.js';
3
6
  export { loadInventory } from './inventory.js';
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { Inventory } from './types.js';
3
+ import { type SbomImport } from './sbom.js';
3
4
  /** Already materialized snapshots cannot import files or expand filesystem references. */
4
5
  export declare const inventorySnapshotSchema: z.ZodObject<{
5
6
  systems: z.ZodArray<z.ZodObject<{
@@ -283,7 +284,7 @@ export declare const inventorySnapshotSchema: z.ZodObject<{
283
284
  * SBOM receiver calls this before it accepts an upload, so an upload it accepts is one a scan uses.
284
285
  * Throws when the file cannot be imported or describes the system with values the inventory refuses.
285
286
  */
286
- export declare function systemFromSbom(path: string, file: string, label: string): {
287
+ export declare function systemFromSbom(path: string, file: string, label: string, imported?: SbomImport): {
287
288
  system: Inventory['systems'][number];
288
289
  warnings: string[];
289
290
  notices: string[];
package/dist/inventory.js CHANGED
@@ -241,8 +241,7 @@ const isoTimestamp = z.iso.datetime({ offset: true });
241
241
  * SBOM receiver calls this before it accepts an upload, so an upload it accepts is one a scan uses.
242
242
  * Throws when the file cannot be imported or describes the system with values the inventory refuses.
243
243
  */
244
- export function systemFromSbom(path, file, label) {
245
- const imported = importSbom(path);
244
+ export function systemFromSbom(path, file, label, imported = importSbom(path)) {
246
245
  const properties = imported.subject?.properties ?? {};
247
246
  const property = (name) => properties[`security-watch:${name}`];
248
247
  const id = property('system-id') ?? basename(file).replace(/(?:\.(?:cdx|spdx|bom|sbom|cyclonedx))?\.json$/i, '');
@@ -278,7 +277,7 @@ export function systemFromSbom(path, file, label) {
278
277
  // data), which is a known limit rather than a fault, so it is said once as a notice instead of
279
278
  // degrading every scan, together with the dependency edges that lead to them.
280
279
  const warnings = [];
281
- const notices = [];
280
+ const notices = (imported.notices ?? []).map((notice) => `${id}: ${notice}`);
282
281
  const unmatched = new Map();
283
282
  for (const warning of imported.warnings) {
284
283
  const kind = UNMATCHED_KIND.exec(warning)?.[1]?.toLowerCase();
@@ -57,6 +57,13 @@ export interface GeneratedSbom {
57
57
  }
58
58
  /** Names of the dependency files `generateSbom` reads, for help text and documentation. */
59
59
  export declare const DEPENDENCY_FILES: Readonly<Record<Ecosystem, readonly string[]>>;
60
+ /** Walks a project for dependency files without following links or entering installed-package folders. */
61
+ /**
62
+ * Whether a path relative to a project (with `/` separators) is a dependency file that reading the
63
+ * project would pick up: a supported name, not inside a hidden or skipped folder, not too deep.
64
+ * Used to take the dependency files of a git commit without checking out the whole tree.
65
+ */
66
+ export declare function isDependencyFilePath(path: string, projectFolder?: string): boolean;
60
67
  /** A package URL (https://github.com/package-url/purl-spec) for a normalised package identity. */
61
68
  export declare function packageUrl(ecosystem: Ecosystem, name: string, version?: string): string;
62
69
  /**
package/dist/manifests.js CHANGED
@@ -892,6 +892,22 @@ export const DEPENDENCY_FILES = {
892
892
  Hackage: ['cabal.project.freeze'],
893
893
  };
894
894
  /** Walks a project for dependency files without following links or entering installed-package folders. */
895
+ /**
896
+ * Whether a path relative to a project (with `/` separators) is a dependency file that reading the
897
+ * project would pick up: a supported name, not inside a hidden or skipped folder, not too deep.
898
+ * Used to take the dependency files of a git commit without checking out the whole tree.
899
+ */
900
+ export function isDependencyFilePath(path, projectFolder = '') {
901
+ const parts = path.split('/');
902
+ if (!parts.length || parts.some((part) => part === '' || part === '.' || part === '..'))
903
+ return false;
904
+ if (parts.length - 1 > MAX_DEPTH)
905
+ return false;
906
+ for (const folder of parts.slice(0, -1))
907
+ if (folder.startsWith('.') || SKIPPED_FOLDERS.has(folder))
908
+ return false;
909
+ return classify(parts.at(-1), parts.length > 1 ? parts.at(-2) : projectFolder) !== undefined;
910
+ }
895
911
  function discover(root, warnings) {
896
912
  const stat = statSync(root);
897
913
  // A link named like a dependency file can point at any file on the machine. The folder given as
@@ -0,0 +1,256 @@
1
+ #!/usr/bin/env node
2
+ import type { HttpClient } from './types.js';
3
+ type Json = null | boolean | number | string | Json[] | {
4
+ [key: string]: Json;
5
+ };
6
+ export declare const TOOLS: readonly [{
7
+ readonly name: 'check_project_vulnerabilities';
8
+ readonly title: 'Check project dependencies for known vulnerabilities';
9
+ readonly description: "Reads every lockfile and manifest in the project (npm, Python, Go, Rust, PHP, Ruby, Java, .NET, Dart, Elixir, Swift, Haskell) and lists known vulnerabilities and malicious packages in the installed versions, most urgent first, each with the fixed version and the file to change. Sends package names and versions (never file contents) to OSV (api.osv.dev) and reads the CISA known-exploited catalog.";
10
+ readonly inputSchema: {
11
+ readonly type: 'object';
12
+ readonly properties: {
13
+ readonly path: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ readonly sbom: {
18
+ readonly type: 'string';
19
+ readonly description: 'A CycloneDX or SPDX JSON SBOM inside the project (from Trivy, Syft, cdxgen, GitHub) to check instead of the dependency files.';
20
+ };
21
+ readonly minSeverity: {
22
+ type: string;
23
+ enum: ("critical" | "high" | "low" | "medium")[];
24
+ description: string;
25
+ };
26
+ readonly production: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ readonly epss: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ };
35
+ readonly additionalProperties: false;
36
+ };
37
+ readonly annotations: {
38
+ readonly readOnlyHint: true;
39
+ readonly openWorldHint: true;
40
+ readonly idempotentHint: true;
41
+ readonly destructiveHint: false;
42
+ };
43
+ }, {
44
+ readonly name: 'check_dependency_change';
45
+ readonly title: 'Check what a dependency change brings in';
46
+ readonly description: "Compares the project's dependency files at a git ref with the working tree (tracked files and untracked ones that are not ignored) and reports only the known vulnerabilities the change adds, and those it fixes. Use it after adding, removing or upgrading dependencies, before you hand the change back. Reads the base files from git; checks nothing out. Sends package names and versions (never file contents) to OSV (api.osv.dev) and reads the CISA known-exploited catalog.";
47
+ readonly inputSchema: {
48
+ readonly type: 'object';
49
+ readonly properties: {
50
+ readonly base: {
51
+ readonly type: 'string';
52
+ readonly description: 'The git ref to compare with. HEAD for uncommitted changes. For a branch, the branch it merges into with three dots, such as origin/main..., compares with the point where the branch left it (plain origin/main would also count what main changed since). After committing, HEAD shows nothing: use HEAD~1 or origin/main....';
53
+ };
54
+ readonly path: {
55
+ readonly type: string;
56
+ readonly description: 'A folder inside the project, relative to its root. Default: the whole project.';
57
+ };
58
+ readonly minSeverity: {
59
+ type: string;
60
+ enum: ("critical" | "high" | "low" | "medium")[];
61
+ description: string;
62
+ };
63
+ readonly production: {
64
+ type: string;
65
+ description: string;
66
+ };
67
+ };
68
+ readonly required: readonly ['base'];
69
+ readonly additionalProperties: false;
70
+ };
71
+ readonly annotations: {
72
+ readonly readOnlyHint: true;
73
+ readonly openWorldHint: true;
74
+ readonly idempotentHint: true;
75
+ readonly destructiveHint: false;
76
+ };
77
+ }, {
78
+ readonly name: 'check_package';
79
+ readonly title: 'Check packages before adding or upgrading them';
80
+ readonly description: "Checks named package versions against OSV before you add or upgrade them: known vulnerabilities, malicious-package records (typosquats, hijacked releases) and the versions that fix each. Leave out the version to list every advisory for the package. OSV does not say whether a package exists: confirm an unfamiliar name in its registry. Sends package names and versions (never file contents) to OSV (api.osv.dev) and reads the CISA known-exploited catalog.";
81
+ readonly inputSchema: {
82
+ readonly type: 'object';
83
+ readonly properties: {
84
+ readonly packages: {
85
+ readonly type: 'array';
86
+ readonly minItems: 1;
87
+ readonly maxItems: 50;
88
+ readonly items: {
89
+ readonly type: 'object';
90
+ readonly properties: {
91
+ readonly ecosystem: {
92
+ readonly type: 'string';
93
+ readonly description: 'npm, PyPI, Go, crates.io, Packagist, RubyGems, Maven, NuGet, Pub, Hex, SwiftURL or Hackage (python, rust, php, ruby, java, dotnet, dart and elixir also work).';
94
+ };
95
+ readonly name: {
96
+ readonly type: 'string';
97
+ readonly description: 'The package name as the registry spells it, such as lodash, @scope/pkg, requests or org.apache.logging.log4j:log4j-core.';
98
+ };
99
+ readonly version: {
100
+ readonly type: 'string';
101
+ readonly description: 'The exact version, such as 4.17.21.';
102
+ };
103
+ };
104
+ readonly required: readonly ['ecosystem', 'name'];
105
+ readonly additionalProperties: false;
106
+ };
107
+ };
108
+ readonly epss: {
109
+ type: string;
110
+ description: string;
111
+ };
112
+ };
113
+ readonly required: readonly ['packages'];
114
+ readonly additionalProperties: false;
115
+ };
116
+ readonly annotations: {
117
+ readonly readOnlyHint: true;
118
+ readonly openWorldHint: true;
119
+ readonly idempotentHint: true;
120
+ readonly destructiveHint: false;
121
+ };
122
+ }, {
123
+ readonly name: 'check_advisory';
124
+ readonly title: 'Does this advisory affect the project?';
125
+ readonly description: "Looks up a CVE, GHSA, PYSEC, RUSTSEC, GO, MAL or other OSV identifier, says which packages and versions it concerns and whether this project has an affected version. Use it when someone asks whether a vulnerability in the news concerns them. Sends package names and versions (never file contents) to OSV (api.osv.dev) and reads the CISA known-exploited catalog.";
126
+ readonly inputSchema: {
127
+ readonly type: 'object';
128
+ readonly properties: {
129
+ readonly id: {
130
+ readonly type: 'string';
131
+ readonly description: 'The advisory ID, such as CVE-2021-44906 or GHSA-xvch-5gv4-984h.';
132
+ };
133
+ readonly path: {
134
+ type: string;
135
+ description: string;
136
+ };
137
+ };
138
+ readonly required: readonly ['id'];
139
+ readonly additionalProperties: false;
140
+ };
141
+ readonly annotations: {
142
+ readonly readOnlyHint: true;
143
+ readonly openWorldHint: true;
144
+ readonly idempotentHint: true;
145
+ readonly destructiveHint: false;
146
+ };
147
+ }, {
148
+ readonly name: 'list_dependencies';
149
+ readonly title: 'List the project dependencies';
150
+ readonly description: 'Lists the dependency files found in the project, package counts per ecosystem, packages that have no exact version (a manifest without its lockfile) and files that could not be read. Optionally lists every package. Reads files only; no network.';
151
+ readonly inputSchema: {
152
+ readonly type: 'object';
153
+ readonly properties: {
154
+ readonly path: {
155
+ type: string;
156
+ description: string;
157
+ };
158
+ readonly production: {
159
+ type: string;
160
+ description: string;
161
+ };
162
+ readonly includePackages: {
163
+ readonly type: 'boolean';
164
+ readonly description: 'Also list every package and version (up to 2,000). Default: false.';
165
+ };
166
+ };
167
+ readonly additionalProperties: false;
168
+ };
169
+ readonly annotations: {
170
+ readonly readOnlyHint: true;
171
+ readonly openWorldHint: false;
172
+ readonly idempotentHint: true;
173
+ readonly destructiveHint: false;
174
+ };
175
+ }, {
176
+ readonly name: 'write_sbom';
177
+ readonly title: 'Write a CycloneDX SBOM';
178
+ readonly description: 'Writes a CycloneDX 1.6 JSON SBOM of the project dependencies to a new file inside the project, for a customer, a compliance request (such as the EU Cyber Resilience Act), Dependency-Track, Trivy or a Security Watch monitor. It replaces an existing file only with overwrite: true, and only when that file is itself an SBOM; it never writes into hidden folders such as .github or .claude. No network.';
179
+ readonly inputSchema: {
180
+ readonly type: 'object';
181
+ readonly properties: {
182
+ readonly output: {
183
+ readonly type: 'string';
184
+ readonly description: 'Where to write it, relative to the project root, ending in .json, such as sbom.cdx.json.';
185
+ };
186
+ readonly path: {
187
+ type: string;
188
+ description: string;
189
+ };
190
+ readonly production: {
191
+ type: string;
192
+ description: string;
193
+ };
194
+ readonly name: {
195
+ readonly type: 'string';
196
+ readonly description: 'System name written into the SBOM. Default: the name in package.json or pyproject.toml, or the folder name.';
197
+ };
198
+ readonly owner: {
199
+ readonly type: 'string';
200
+ readonly description: 'Who to ask about this system, such as "Dana, platform team".';
201
+ };
202
+ readonly environment: {
203
+ readonly type: 'string';
204
+ readonly description: 'Such as production or staging.';
205
+ };
206
+ readonly note: {
207
+ readonly type: 'string';
208
+ readonly description: 'Where the system runs; Security Watch shows it in alerts.';
209
+ };
210
+ readonly exposure: {
211
+ readonly type: 'string';
212
+ readonly enum: readonly ['internet', 'internal', 'unknown'];
213
+ };
214
+ readonly overwrite: {
215
+ readonly type: 'boolean';
216
+ readonly description: 'Replace the file if it exists and is a CycloneDX or SPDX SBOM. Default: false.';
217
+ };
218
+ };
219
+ readonly required: readonly ['output'];
220
+ readonly additionalProperties: false;
221
+ };
222
+ readonly annotations: {
223
+ readonly readOnlyHint: false;
224
+ readonly openWorldHint: false;
225
+ readonly idempotentHint: true;
226
+ readonly destructiveHint: true;
227
+ };
228
+ }];
229
+ /** A folder can be a project root unless it is a filesystem root, the home folder or above it. */
230
+ export declare function usableRoot(candidate: string, home?: string): boolean;
231
+ export interface ServerOptions {
232
+ /** The project folder, or undefined to take it from the client's roots. */
233
+ root?: string;
234
+ /** The Security Watch configuration for list_watch_findings. */
235
+ config?: string;
236
+ http?: HttpClient;
237
+ home?: string;
238
+ now?: () => number;
239
+ }
240
+ export declare class SecurityWatchMcpServer {
241
+ #private;
242
+ constructor(options: ServerOptions, send: (message: Json) => void);
243
+ get root(): string | undefined;
244
+ tools(): Json;
245
+ /** Handles one message from the client. Responses go through `send`. */
246
+ handle(raw: unknown): Promise<void>;
247
+ }
248
+ /** Serves MCP over stdio: one JSON-RPC message per line, answered as each finishes. */
249
+ export declare function serveStdio(options: ServerOptions, input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): SecurityWatchMcpServer;
250
+ /**
251
+ * `security-watch mcp [project]` and `security-watch-mcp [project]`. The project is the argument,
252
+ * else CLAUDE_PROJECT_DIR, else the working folder, else the first root the client names.
253
+ * SECURITY_WATCH_CONFIG names a monitor configuration for list_watch_findings.
254
+ */
255
+ export declare function mcpMain(args: readonly string[]): void;
256
+ export {};