@shieldaai/security-watch 1.3.0 → 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.
- package/CHANGELOG.md +21 -0
- package/CONTRIBUTING.md +2 -0
- package/README.md +68 -42
- package/dist/check.d.ts +193 -0
- package/dist/check.js +1000 -0
- package/dist/cli.js +115 -2
- package/dist/inventory.d.ts +2 -1
- package/dist/inventory.js +1 -2
- package/dist/manifests.d.ts +7 -0
- package/dist/manifests.js +16 -0
- package/dist/mcp-server.d.ts +256 -0
- package/dist/mcp-server.js +755 -0
- package/dist/sources.d.ts +2 -0
- package/dist/sources.js +4 -0
- package/docs/agents.md +139 -0
- package/docs/offline-advisory-preview.md +2 -2
- package/docs/sbom.md +3 -3
- package/npm-shrinkwrap.json +237 -0
- package/package.json +10 -5
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import { parse as parseYaml, stringify } from 'yaml';
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { loadConfig, parseConfig, missingCredentials } from './config.js';
|
|
10
10
|
import { loadInventory } from './inventory.js';
|
|
11
|
+
import { checkAdvisory, checkChange, checkPackages, checkProject, formatAdvisoryReport, formatChangeReport, formatCheckReport, failsAt, } from './check.js';
|
|
11
12
|
import { shieldCandidates } from './shield-candidates.js';
|
|
12
13
|
import { openVex } from './vex.js';
|
|
13
14
|
import { exportProblems, maxAges, readMitigationExport, withCurrentMitigations } from './mitigations.js';
|
|
@@ -67,6 +68,13 @@ function firstScanNotice(config, store, offline) {
|
|
|
67
68
|
const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
68
69
|
const help = `Shielda Security Watch ${VERSION}
|
|
69
70
|
|
|
71
|
+
security-watch check [PROJECT] [--production] [--epss] [--fail-on high] [--json]
|
|
72
|
+
security-watch check [PROJECT] --base REF (only what a change since REF brings in)
|
|
73
|
+
security-watch check --sbom FILE.json
|
|
74
|
+
security-watch check --package npm:lodash@4.17.21 [--package pypi:requests@2.31.0 ...]
|
|
75
|
+
security-watch check [PROJECT] --advisory CVE-2021-44906
|
|
76
|
+
security-watch mcp [PROJECT] (MCP server on stdio, for AI agents)
|
|
77
|
+
|
|
70
78
|
security-watch sbom [--project PATH] [--output FILE.cdx.json] [--name NAME] [--system-id ID]
|
|
71
79
|
[--owner TEXT] [--environment TEXT] [--note TEXT] [--exposure internet|internal|unknown]
|
|
72
80
|
[--criticality low|medium|high|critical] [--production] [--source-url URL] [--source-revision REV]
|
|
@@ -111,6 +119,13 @@ const help = `Shielda Security Watch ${VERSION}
|
|
|
111
119
|
security-watch unlock (only removes a stopped worker's lock)
|
|
112
120
|
security-watch test-notification --channel slack|email
|
|
113
121
|
|
|
122
|
+
check asks OSV about every package in a project now and marks CISA known-exploited entries; it
|
|
123
|
+
sends package names and versions (and, with --epss, CVE IDs to FIRST), stores nothing and needs no
|
|
124
|
+
configuration. Exit code 1: an installed version affected at or above --fail-on (high; malware and
|
|
125
|
+
known-exploited always count, an advisory without a severity counts as medium, a package without an
|
|
126
|
+
exact version never does; none never fails); 2: the check is incomplete (a source failed or a
|
|
127
|
+
dependency file could not be read). --base REF... compares with the point where the branch left REF.
|
|
128
|
+
|
|
114
129
|
sbom reads the lockfiles and manifests in a project (npm, Python, Go, Rust, PHP, Ruby, Java,
|
|
115
130
|
.NET, Dart, Elixir, Swift, Haskell) and writes a CycloneDX SBOM. It runs nothing and sends nothing.
|
|
116
131
|
init --project creates a monitor for that project in one step. With an intake section in the
|
|
@@ -200,6 +215,13 @@ function argumentsFromCommandLine() {
|
|
|
200
215
|
system: { type: 'string' },
|
|
201
216
|
store: { type: 'string' },
|
|
202
217
|
running: { type: 'string' },
|
|
218
|
+
sbom: { type: 'string' },
|
|
219
|
+
base: { type: 'string' },
|
|
220
|
+
package: { type: 'string', multiple: true },
|
|
221
|
+
advisory: { type: 'string' },
|
|
222
|
+
epss: { type: 'boolean' },
|
|
223
|
+
'fail-on': { type: 'string' },
|
|
224
|
+
json: { type: 'boolean' },
|
|
203
225
|
},
|
|
204
226
|
});
|
|
205
227
|
}
|
|
@@ -616,6 +638,76 @@ async function initialize() {
|
|
|
616
638
|
(values.heartbeat ? 'HEARTBEAT_URL=\n' : '# HEARTBEAT_URL=\n'), { flag: 'wx', mode: 0o600 });
|
|
617
639
|
console.log(`Created ${configPath} and ${inventoryPath}. ${sbomFiles.length ? 'Each SBOM in sboms/ is one system; add owners and notes with security-watch sbom --owner/--note, or describe more systems in systems.yaml.' : 'Add installed versions and deployment details to systems.yaml.'} Copy .env.example to .env and fill in any required credentials. Then run:\n security-watch doctor --config ${shellArgument(configPath)} --credentials-file ${shellArgument(resolve(directory, '.env'))}\n security-watch scan --config ${shellArgument(configPath)} --credentials-file ${shellArgument(resolve(directory, '.env'))} --dry-run\nNo messages were sent.`);
|
|
618
640
|
}
|
|
641
|
+
/** `ecosystem:name@version`, such as npm:lodash@4.17.21, npm:@scope/pkg@1.0.0 or maven:org.x:lib@2.1. */
|
|
642
|
+
function packageArgument(value) {
|
|
643
|
+
const colon = value.indexOf(':');
|
|
644
|
+
if (colon < 1)
|
|
645
|
+
throw new Error(`--package ${value}: write it as ecosystem:name@version, such as npm:lodash@4.17.21.`);
|
|
646
|
+
const rest = value.slice(colon + 1).replace('==', '@');
|
|
647
|
+
const at = rest.lastIndexOf('@');
|
|
648
|
+
return at > 0
|
|
649
|
+
? { ecosystem: value.slice(0, colon), name: rest.slice(0, at), version: rest.slice(at + 1) }
|
|
650
|
+
: { ecosystem: value.slice(0, colon), name: rest };
|
|
651
|
+
}
|
|
652
|
+
async function runCheck() {
|
|
653
|
+
if ((values.project?.length ?? 0) + (id ? 1 : 0) > 1)
|
|
654
|
+
throw new Error('check reads one project at a time.');
|
|
655
|
+
const project = id ?? values.project?.[0];
|
|
656
|
+
const failOn = values['fail-on'] ?? 'high';
|
|
657
|
+
if (!['critical', 'high', 'medium', 'low', 'none'].includes(failOn))
|
|
658
|
+
throw new Error('--fail-on must be critical, high, medium, low or none.');
|
|
659
|
+
if (values.package && (project || values.sbom || values.base || values.advisory))
|
|
660
|
+
throw new Error('--package checks the named packages only; leave out the project, --sbom, --base and --advisory.');
|
|
661
|
+
if (values.base && (values.sbom || values.advisory))
|
|
662
|
+
throw new Error('--base compares a project folder with git; it cannot be combined with --sbom or --advisory.');
|
|
663
|
+
if (values.sbom && project)
|
|
664
|
+
throw new Error('Give a project or --sbom, not both.');
|
|
665
|
+
const common = {
|
|
666
|
+
...(values.epss ? { epss: true } : {}),
|
|
667
|
+
...(values.production ? { production: true } : {}),
|
|
668
|
+
};
|
|
669
|
+
const target = {
|
|
670
|
+
...common,
|
|
671
|
+
...(project ? { project } : {}),
|
|
672
|
+
...(values.sbom ? { sbom: values.sbom } : {}),
|
|
673
|
+
};
|
|
674
|
+
let failing;
|
|
675
|
+
let degraded;
|
|
676
|
+
let result;
|
|
677
|
+
let text;
|
|
678
|
+
if (values.package) {
|
|
679
|
+
const report = await checkPackages(values.package.map(packageArgument), common);
|
|
680
|
+
[failing, degraded, result, text] = [report.findings, report.degraded, report, formatCheckReport(report)];
|
|
681
|
+
}
|
|
682
|
+
else if (values.advisory) {
|
|
683
|
+
const report = await checkAdvisory(values.advisory, target);
|
|
684
|
+
[failing, degraded, result, text] = [
|
|
685
|
+
report.findings,
|
|
686
|
+
report.project.degraded,
|
|
687
|
+
report,
|
|
688
|
+
formatAdvisoryReport(report),
|
|
689
|
+
];
|
|
690
|
+
}
|
|
691
|
+
else if (values.base) {
|
|
692
|
+
const report = await checkChange({ ...target, base: values.base });
|
|
693
|
+
[failing, degraded, result, text] = [
|
|
694
|
+
report.added,
|
|
695
|
+
report.head.degraded,
|
|
696
|
+
report,
|
|
697
|
+
formatChangeReport(report),
|
|
698
|
+
];
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
const report = await checkProject(target);
|
|
702
|
+
[failing, degraded, result, text] = [report.findings, report.degraded, report, formatCheckReport(report)];
|
|
703
|
+
}
|
|
704
|
+
if (values.json)
|
|
705
|
+
output(result);
|
|
706
|
+
else
|
|
707
|
+
console.log(text);
|
|
708
|
+
const fails = failing.some((finding) => failsAt(finding, failOn));
|
|
709
|
+
process.exitCode = fails ? 1 : degraded ? 2 : 0;
|
|
710
|
+
}
|
|
619
711
|
async function main() {
|
|
620
712
|
if (values.version) {
|
|
621
713
|
console.log(VERSION);
|
|
@@ -626,6 +718,8 @@ async function main() {
|
|
|
626
718
|
return;
|
|
627
719
|
}
|
|
628
720
|
const commandFlags = {
|
|
721
|
+
check: ['project', 'sbom', 'base', 'package', 'advisory', 'production', 'epss', 'fail-on', 'json'],
|
|
722
|
+
mcp: [],
|
|
629
723
|
sbom: [
|
|
630
724
|
'project',
|
|
631
725
|
'output',
|
|
@@ -710,9 +804,27 @@ async function main() {
|
|
|
710
804
|
for (const flag of Object.keys(values))
|
|
711
805
|
if (!commandFlags[command].includes(flag))
|
|
712
806
|
throw new Error(`--${flag} is not supported by ${command}.`);
|
|
713
|
-
const needsId = [
|
|
807
|
+
const needsId = [
|
|
808
|
+
'explain',
|
|
809
|
+
'history',
|
|
810
|
+
'review',
|
|
811
|
+
'acknowledge',
|
|
812
|
+
'suppress',
|
|
813
|
+
'retry',
|
|
814
|
+
'check',
|
|
815
|
+
'mcp',
|
|
816
|
+
].includes(command);
|
|
714
817
|
if (positionals.length > (needsId ? 2 : 1))
|
|
715
818
|
throw new Error('Unexpected positional arguments. Use --help.');
|
|
819
|
+
if (command === 'check') {
|
|
820
|
+
await runCheck();
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
if (command === 'mcp') {
|
|
824
|
+
const { mcpMain } = await import('./mcp-server.js');
|
|
825
|
+
mcpMain(id ? [id] : []);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
716
828
|
if (command === 'init') {
|
|
717
829
|
await initialize();
|
|
718
830
|
return;
|
|
@@ -1610,5 +1722,6 @@ main().catch((error) => {
|
|
|
1610
1722
|
console.error('Invalid YAML; check configuration/inventory syntax.');
|
|
1611
1723
|
else
|
|
1612
1724
|
console.error(error instanceof Error ? error.message : 'Operation failed');
|
|
1613
|
-
|
|
1725
|
+
// check uses 1 for "found something"; a check that could not run is 2, like an incomplete one.
|
|
1726
|
+
process.exitCode = command === 'check' ? 2 : 1;
|
|
1614
1727
|
});
|
package/dist/inventory.d.ts
CHANGED
|
@@ -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, '');
|
package/dist/manifests.d.ts
CHANGED
|
@@ -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 {};
|