@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.
- package/CHANGELOG.md +45 -0
- package/CONTRIBUTING.md +2 -0
- package/README.md +69 -42
- package/SECURITY.md +4 -1
- package/dist/check.d.ts +193 -0
- package/dist/check.js +1000 -0
- package/dist/cli.js +301 -6
- package/dist/config.d.ts +22 -0
- package/dist/config.js +32 -0
- package/dist/cve-now.js +2 -0
- package/dist/delivery.js +30 -0
- package/dist/engine.d.ts +25 -0
- package/dist/engine.js +64 -4
- package/dist/index.d.ts +8 -1
- package/dist/index.js +3 -0
- package/dist/inventory.d.ts +2 -1
- package/dist/inventory.js +2 -3
- 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/mitigations.d.ts +137 -0
- package/dist/mitigations.js +426 -0
- package/dist/rehearsal.d.ts +25 -0
- package/dist/rehearsal.js +2 -0
- package/dist/sbom.d.ts +12 -1
- package/dist/sbom.js +37 -7
- package/dist/shield-candidates.d.ts +97 -0
- package/dist/shield-candidates.js +251 -0
- package/dist/shield-inputs.d.ts +49 -0
- package/dist/shield-inputs.js +297 -0
- package/dist/shirudo-sboms.d.ts +62 -0
- package/dist/shirudo-sboms.js +598 -0
- package/dist/sources.d.ts +2 -0
- package/dist/sources.js +14 -0
- package/dist/store.js +6 -4
- package/dist/types.d.ts +31 -0
- package/dist/vex.d.ts +62 -0
- package/dist/vex.js +246 -0
- package/docs/agents.md +139 -0
- package/docs/configuration.md +20 -1
- package/docs/mitigations.md +139 -0
- package/docs/offline-advisory-preview.md +2 -2
- package/docs/sbom.md +4 -4
- package/docs/shirudo.md +113 -0
- package/npm-shrinkwrap.json +237 -0
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
Versions follow [semantic versioning](https://semver.org/). What counts as a compatible change is defined in the [compatibility policy](docs/compatibility.md).
|
|
4
4
|
|
|
5
|
+
## 1.4.0
|
|
6
|
+
|
|
7
|
+
Security Watch answers now what the monitor answers over time, for people and for AI coding agents, and is published as a signed container image. Existing configurations, inventories and databases work unchanged. To be published under the default `latest` tag; the GitHub Action is used as `uses: ShieldaAI/security-watch@v1.4.0`.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`security-watch check`.** One command, no configuration, nothing stored: reads a project's dependency files (or `--sbom FILE`), asks OSV about every package version, marks CISA known-exploited entries and, with `--epss`, adds EPSS. Findings are sorted malware first, then known exploited, then by priority, each with the fixed versions above the installed one and the files the package came from. `--base REF` reads the dependency files at a git commit with `git cat-file` (nothing is checked out, and a partial clone fetches nothing) and reports what the working tree added, what it fixed, and which packages were added, removed or changed. `--package ecosystem:name@version` (repeatable) checks packages before they are added; `--advisory ID` says whether a CVE, GHSA, PYSEC, RUSTSEC, GO or MAL record affects the project, following a CVE record's aliases to the records that name packages. `--base REF...` compares with the point where the branch left REF. Both sides are the files git knows (the working tree: tracked files and untracked ones that are not ignored), so submodules and ignored folders are left out. `--json`, `--production`, `--fail-on`. Exit code 1 when an installed version is affected at or above `--fail-on` (high; malware and known-exploited always count; an advisory without a severity counts as medium; a package without an exact version never fails), 2 when the check is incomplete: a source failed or a dependency file could not be read, which is said first in the output. A package with several findings gets one version that fixes them all. It runs the monitor's own engine on an in-memory database, so a check and the monitor agree. Library functions `checkProject`, `checkPackages`, `checkChange` and `checkAdvisory` in `dist/check.js` (not yet part of the stable exports).
|
|
12
|
+
- **MCP server for AI agents.** `security-watch mcp [PROJECT]` and the `security-watch-mcp` bin serve seven tools over stdio: `check_project_vulnerabilities`, `check_dependency_change`, `check_package`, `check_advisory`, `list_dependencies`, `write_sbom` (the only tool that writes: inside the project, never replacing a file unasked) and `list_watch_findings` (read-only, listed only when `SECURITY_WATCH_CONFIG` names a monitor configuration). Paths must stay inside the project, links that lead out are refused, and a server started in a filesystem root or the home folder asks the client for its roots (a tool call waits for the answer). A cancelled call stops before its next request to a source and sends no reply. `write_sbom` writes only outside hidden folders, never through a link that leads out, and replaces only an existing SBOM, with `overwrite: true`. Protocol versions 2024-11-05 to 2025-11-25. See [Security Watch for AI agents](docs/agents.md).
|
|
13
|
+
- **Plugin for Claude Code, Codex, ChatGPT and Antigravity.** `plugins/security-watch`: the MCP server through a launcher that runs npm's own npx for the pinned version from outside the project (so the project's `.npmrc` and `node_modules` cannot choose the checker), and two skills, one for checking dependencies before and after a change and one for setting up the monitor. Marketplace `shielda-security-watch` (`/plugin marketplace add ShieldaAI/security-watch`). `npm run pack:plugins` builds the archives for OpenAI's portal.
|
|
14
|
+
- **Container image.** Every release tag publishes `ghcr.io/shieldaai/security-watch` (`x.y.z`, `x.y` and `latest` for stable releases) for linux/amd64 and linux/arm64, after the test suite and the container checks pass, with an SBOM and build provenance attached and a keyless Sigstore signature. `compose.yaml` uses it. The image carries the OCI source label and the MCP Registry label.
|
|
15
|
+
- **MCP Registry entry.** `server.json` lists the npm package and the image as `io.github.ShieldaAI/security-watch`; `package.json` carries the matching `mcpName`.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- The published package includes `npm-shrinkwrap.json`, written from `package-lock.json` at pack time with runtime packages only, so `npx` and global installs get exactly the dependency tree the release was tested with, sub-dependencies included. `npm run check:package` installs the packed tarball and checks every runtime package version.
|
|
20
|
+
- `compose.yaml` pulls the published image instead of building one.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- The README no longer lists EPSS among the integrations Security Watch lacks; it has had EPSS since 1.2.0.
|
|
25
|
+
|
|
26
|
+
## 1.3.0
|
|
27
|
+
|
|
28
|
+
Security Watch hands findings to whoever writes temporary mitigations (runtime shields, blocking policies, firewall rules), shows which hosts a mitigation covers, works with [Shirudo](docs/shirudo.md), writes OpenVEX for other scanners, and reads CycloneDX up to 1.7. Existing configurations and inventories work unchanged. To be published under the default `latest` tag; the GitHub Action is used as `uses: ShieldaAI/security-watch@v1.3.0`.
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **Fix links, fix commits, weaknesses and exploit code are kept.** OSV and GitHub advisories keep their typed links: code changes (commits, pull and merge requests, compare views of two releases, patches, kernel.org, gitweb, googlesource and Mercurial commits) are `fix`; a page typed as a fix that is not a code change, and any change to an advisory database, is an `advisory`. OSV keeps the commits its `GIT` ranges name as fixes, both keep their CWE identifiers, and cve.now keeps its Exploit-DB, Metasploit, Nuclei and GitHub proof-of-concept entries when they name something. Only https links to public names, without credentials or inner whitespace, at most 40 links, 20 commits and 20 weaknesses per advisory. A malformed value is dropped, never the advisory. They are never sent to models and are left out of an advisory's content hash and a finding's analysis basis, so the upgrade records no new evidence revision, re-sends nothing and asks no model again. `explain` shows them. New `Evidence` fields `references`, `fix_commits`, `weaknesses` and `exploit_sources`; exported types `AdvisoryReference`, `FixCommit` and `ReferenceType`.
|
|
33
|
+
- **`security-watch shield-candidates`.** Lists active findings that are critical or known or reported to be exploited (`--all` for every finding that may affect you), with a `readiness`: `fix_known` (the installed version is affected and an advisory links the fix for this package), `fixed_version_known`, `advisory_only` or `news_only`, and a `missing` list in plain words. News alone is never enough to write a mitigation, and is listed as such. An advisory that covers several packages counts its fix links only for the package they name. `--unmitigated` leaves out findings that every source proves mitigated on every host now; `--omit-location` leaves out system IDs, names, owners, notes, package URL qualifiers, news links and mitigation details; `--output NEW.json` writes a new private file. Read-only. Library function `shieldCandidates` and its types.
|
|
34
|
+
- **Mitigation status, optional.** A `mitigations` list (up to ten sources) reads JSON Lines files that your tools write on a timer, in Shirudo's `node_vulns` format or a [generic format](docs/mitigations.md#mitigation-status) any tool can write (with an optional `expires_at`), and shows per finding how many hosts of the system are mitigated, waiting, failed, excluded, withdrawn, expired or not mitigated, and what is in place: in alerts, digests, `explain`, `findings`, `shield-candidates` and `vex` (`Assessment.mitigations`, exported types `MitigationStatus`, `MitigationState`, `MitigationSource` and `MitigationFormat`). Like EPSS it is shown only: it changes no applicability, priority or routing, creates no revision and never closes a finding. A missing, unreadable, empty, out-of-date or future-dated file, values the release does not know, and rows that all miss the inventory are monitoring-health errors; `doctor` checks every file. A saved status is judged again when read, so `findings`, `explain`, `shield-candidates` and `vex` never show it as current after scans stop or a mitigation expires. Security Watch never connects to a mitigation tool.
|
|
35
|
+
- **`security-watch shirudo-sboms`.** Copies the SBOMs of Shirudo's images from a local copy of its SBOM store into the SBOM folder, one system per image (the image ID, stable across upgrades). With the export it watches the images machines run, merging the SBOMs of versions that run side by side; without it, the newest version. It writes, replaces and removes only its own files, compactly and atomically; it removes a file only when its image is known to be gone, never because a read failed, the store is empty or the export is incomplete, and removes more than half of its images only with `--allow-removals`; it reports an image whose ID another system uses (with `--config`, also systems described by hand); and it shows its plan unless `--apply` is given. Library function `syncShirudoSboms`.
|
|
36
|
+
- **`security-watch vex`.** Writes an OpenVEX 0.2.0 document for library findings with an exact package version: `affected` with the action (update, follow the advisory, remove a malicious package, and a current mitigation), `under_investigation`, and `not_affected` only with `--include-not-affected`. Package URLs come from the inventory with only descriptive qualifiers (`classifier`, `type`, `arch`, `distro`, `os`, `epoch`), or are built per the package URL specification. Statements of the same package in several systems are merged to the most severe. An unchanged state gives the same document identifier. `--omit-mitigations` leaves the mitigation part of the action out. Library function `openVex`.
|
|
37
|
+
- **CycloneDX 1.2 to 1.7.** SBOMs from CycloneDX 1.2 up to 1.7 are read (1.4 to 1.6 before); a later 1.x is read by the 1.7 rules with a notice that does not degrade monitoring; 2.x and malformed versions are refused. A CycloneDX document without a `components` list is an empty system instead of an error. `security-watch sbom` still writes 1.6, which more tools read.
|
|
38
|
+
- Guides: [temporary mitigations](docs/mitigations.md) and [Security Watch with Shirudo](docs/shirudo.md).
|
|
39
|
+
|
|
40
|
+
### Verified
|
|
41
|
+
|
|
42
|
+
- The VEX output was loaded into Trivy 0.71.2 (`trivy sbom --vex`): `not_affected` statements suppressed exactly their CVEs for npm (including a scoped package whose inventory purl was written with a literal `@`) and for a Maven package whose purl Security Watch built; `affected` and `under_investigation` statements left the findings in the report.
|
|
43
|
+
|
|
44
|
+
### Not verified
|
|
45
|
+
|
|
46
|
+
- The Shirudo integration follows Shirudo's documentation of 24 November 2026 and is tested against files in that format, not against a running Shirudo deployment, which needs Shirudo's kernel patches and a TPM. Shirudo is pre-release.
|
|
47
|
+
- Upgrading is tested with a database written by the released 1.2.1 build (`test/fixtures/watch-1.2.1.db`): no revision, fingerprint, delivery or analysis basis changes.
|
|
48
|
+
- How often advisories carry fix links and exploit entries was measured on one advisory (Log4Shell), not on a corpus.
|
|
49
|
+
|
|
5
50
|
## 1.2.1
|
|
6
51
|
|
|
7
52
|
Fixes from an edge-case review: alerts sent twice for analysed news, packages missed in Python and Go projects, and a worker that paused when the clock stepped back. No configuration change. To be published under the default `latest` tag; the GitHub Action is used as `uses: ShieldaAI/security-watch@v1.2.1`.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -85,6 +85,8 @@ Use fixture-based affected/fixed pairs, conflicting sources, malformed input, so
|
|
|
85
85
|
|
|
86
86
|
The package is `@shieldaai/security-watch`. Stable versions publish under `latest` and prereleases (release candidates) under `next`. The one supported publish command is `npm run release` (rehearse with `npm run release -- --dry-run`): it chooses the tag from the version and passes it to `npm publish` explicitly. Do not run `npm publish` yourself and do not pass `--tag`. npm hands a command-line option to lifecycle scripts only when it differs from the default, so `prepublishOnly` cannot tell `npm publish --tag latest` from a bare `npm publish`, while npm lets that option override `publishConfig.tag`. `prepublishOnly` therefore refuses a publish that does not carry the tag statement `npm run release` sets, and any tag that is wrong for the version. `npm run release` accepts only `--dry-run` and `--otp=CODE`. These checks prevent mistakes; they are lifecycle scripts, so `npm publish --ignore-scripts` or setting `SECURITY_WATCH_RELEASE_TAG` by hand bypasses them, and neither is ever the right thing to do. `npm run release` and the release check refuse to run when npm is set to ignore scripts or to use another registry (`--ignore-scripts` or `--registry` typed before the `--`, a line in `.npmrc`, or an `npm_config_` environment variable), including a scoped `@shieldaai:registry` line in `.npmrc`. A scoped registry typed as an option before the `--` is not passed on by npm at all, so the publish goes to the official registry. The release check also refuses a package that would contain a file that is not in git, such as an ignored file left in `docs/` or `examples/`. The version is defined in `package.json`; `test/public-api.test.mjs` checks that the lockfile, `compose.yaml`, `CHANGELOG.md`, the README, `docs/offline-advisory-preview.md` and `scripts/check-docker.mjs` agree with it and that the exported names match `scripts/public-api.json`. A change to that list is a compatibility decision: record it in the changelog and follow the [compatibility policy](docs/compatibility.md). Before publishing, commit the reviewed changes, run `npm run check`, and inspect the output of `npm pack --dry-run`. The check command installs the tarball in a clean consumer and verifies the CLI, types and runtime exports. `prepublishOnly` repeats the checks and requires a clean checkout.
|
|
87
87
|
|
|
88
|
+
After npm serves the new version: the `v*` tag starts the container image workflow (`.github/workflows/image.yml`), which publishes, attests and signs `ghcr.io/shieldaai/security-watch` (the very first publish creates a private package: make it public once in the package settings, or nobody can pull it); then move `plugin-stable` to the release commit (`git push origin <commit>:refs/heads/plugin-stable`, which the Claude plugin directory follows), publish `server.json` to the MCP Registry with `mcp-publisher publish`, and upload the archive from `npm run pack:plugins` to OpenAI's plugin portal. Every version pin in `plugins/security-watch`, `server.json`, `docs/agents.md` and the skills moves in the version commit; `test/plugins.test.mjs` fails otherwise.
|
|
89
|
+
|
|
88
90
|
Only repository administrators can create `v*` release tags. These tags cannot be changed or deleted, including by administrators.
|
|
89
91
|
|
|
90
92
|
Update package metadata, CLI version output, the lockfile and release documentation together. Release notes should name the runtimes and provider protocols tested, and distinguish mocked checks from live integrations. Record any checks that could not run.
|
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ intake:
|
|
|
86
86
|
|
|
87
87
|
```yaml
|
|
88
88
|
# GitHub Actions: makes the SBOM and sends it; the job fails if the monitor refuses it
|
|
89
|
-
- uses: ShieldaAI/security-watch@v1.
|
|
89
|
+
- uses: ShieldaAI/security-watch@v1.4.0
|
|
90
90
|
with:
|
|
91
91
|
system-id: my-app
|
|
92
92
|
owner: Dana, platform team
|
|
@@ -96,7 +96,7 @@ intake:
|
|
|
96
96
|
|
|
97
97
|
```sh
|
|
98
98
|
# Any other pipeline with Node.js 24 and SECURITY_WATCH_INTAKE_TOKEN set
|
|
99
|
-
npx --yes @shieldaai/security-watch@1.
|
|
99
|
+
npx --yes @shieldaai/security-watch@1.4.0 sbom --system-id my-app --upload https://watch.example.com:8787
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
[Watch a project from its dependency files](docs/sbom.md) covers the files that are read, GitLab CI, the receiver (tokens limited to some systems, TLS, Docker), other ways to deliver SBOMs, and SBOMs from Trivy, Syft, cdxgen or GitHub's dependency graph, which are accepted as they are.
|
|
@@ -130,18 +130,33 @@ If your list contains libraries that are not npm packages (Python, PHP, Java, Go
|
|
|
130
130
|
|
|
131
131
|
To try it with no network access and fictional data first, follow the [offline advisory preview](docs/offline-advisory-preview.md). The rest of this page covers the options in detail.
|
|
132
132
|
|
|
133
|
-
**Version 1.
|
|
133
|
+
**Version 1.4.0.** This is `@shieldaai/security-watch` 1.4.0, a minor release of the first stable version (1.0.0). It answers in one command what the monitor answers over time (`security-watch check`: a project, a change since a git commit, a package, an advisory), gives AI coding agents the same checks through an [MCP server and a plugin](docs/agents.md), and is published as a signed container image (`ghcr.io/shieldaai/security-watch`); 1.3 added `shield-candidates`, mitigation status, [Shirudo](docs/shirudo.md) and OpenVEX, 1.2 read scores and exploitation reports from news and added EPSS, and 1.1 added SBOM generation, an SBOM folder for pipelines, SPDX import and a GitHub Action. It is published under the default `latest` tag and has no independent security audit. Read the [coverage and security limits](SECURITY.md) before relying on it, the [compatibility policy](docs/compatibility.md) for what stays stable, and the [changelog](CHANGELOG.md) for what changed.
|
|
134
134
|
|
|
135
135
|
Related projects: [Agent Guard](https://github.com/ShieldaAI/agent-guard) for tool permissions and approvals, and [SafeCall Node](https://github.com/GuardianMesh/llm-safecall-node) or [SafeCall Python](https://github.com/GuardianMesh/llm-safecall) for model response validation. The [package selection guide](https://github.com/ShieldaAI/agent-guard/blob/main/docs/package-guide.md) explains how they fit together.
|
|
136
136
|
|
|
137
|
+
## Check now, or let your AI agent check
|
|
138
|
+
|
|
139
|
+
No configuration is needed for a one-off answer. `check` reads the project's lockfiles, asks OSV about every package version and marks CISA known-exploited entries:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
npx --yes @shieldaai/security-watch@1.4.0 check # this project
|
|
143
|
+
npx --yes @shieldaai/security-watch@1.4.0 check --base origin/main # only what this branch brings in
|
|
144
|
+
npx --yes @shieldaai/security-watch@1.4.0 check --package npm:lodash@4.17.21
|
|
145
|
+
npx --yes @shieldaai/security-watch@1.4.0 check --advisory CVE-2021-44906
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Exit code 1 means a finding at or above `--fail-on` (high by default), 2 that the check could not complete. AI coding agents get the same checks, plus SBOM writing, from `security-watch mcp` or the plugin for Claude Code, Codex and Antigravity: they check a package before adding it and a dependency change before handing it back. See [Security Watch for AI agents](docs/agents.md).
|
|
149
|
+
|
|
137
150
|
## Features
|
|
138
151
|
|
|
152
|
+
- One-off checks and AI agents: `security-watch check` for a project, a git change, a package or an advisory, and an [MCP server and plugin](docs/agents.md) with the same checks for coding agents, including OSV malicious-package records.
|
|
139
153
|
- Inventories from your code: `security-watch sbom` and `init --project` read the lockfiles and manifests of 12 ecosystems and write a CycloneDX SBOM; an SBOM folder turns every SBOM your pipelines deliver into a monitored system. A [GitHub Action](docs/sbom.md#github-actions) and a one-line command for other CI are included. Hand-written YAML/JSON inventories and library lists still work. Names alone are accepted; exact installed versions improve applicability checks.
|
|
140
154
|
- cve.now CVE updates and npm stack checks, plus The Hacker News security articles. Optional sources include OSV, GitHub, CISA KEV, official Node.js/Python/PHP feeds and other RSS/Atom feeds.
|
|
141
155
|
- Structured library checks without AI, with optional AI analysis to distinguish new vulnerabilities, updates to known vulnerabilities and general system news. Each finding records source severity, applicability and contextual priority separately.
|
|
142
156
|
- Separate alert thresholds for libraries, products and news, plus review digests and configurable overrides for potentially critical findings, known exploitation and malware.
|
|
143
157
|
- Slack incoming webhooks and SMTP email, backed by a SQLite delivery queue. An email is retried automatically only when it provably never left. A Slack message is retried when Slack answers HTTP 429 or 5xx or the connection fails before the request is sent; in rare cases Slack may have posted a message it answered 5xx for. Any other uncertain delivery is recorded for manual review and retry.
|
|
144
158
|
- Per-source coverage receipts, bounded CycloneDX and SPDX import (output of Trivy, Syft, cdxgen and GitHub's dependency graph) with package URLs and dependency relationships, and inventory drift reports. Optional artifact kinds cover MCP servers/clients, plugins, skills and models; signature, attestation and remediation lifecycle fields record operator-supplied evidence. They do not perform verification or close findings. See [deployment evidence](docs/configuration.md#agent-deployment-evidence-sboms-and-drift).
|
|
159
|
+
- [Temporary mitigations](docs/mitigations.md): `shield-candidates` lists critical and exploited findings with what someone writing a runtime shield, a blocking policy or a firewall rule needs (fix commits and patch links, installed and fixed versions, weakness types, public exploit code) and says what is still missing; news alone is never enough. Alerts can say how many hosts a mitigation covers, read from files your tools write ([Shirudo](docs/shirudo.md) or a generic format). `vex` writes OpenVEX for scanners such as Trivy and Grype. Mitigations are shown only: they never lower a priority or close a finding.
|
|
145
160
|
- Finding history, revision-bound AI dismissal review, acknowledgement, suppression with an expiry, source checkpoints and model budgets. Optional external heartbeats, bounded retention and verified backups support ongoing operation.
|
|
146
161
|
|
|
147
162
|
| Inventory item | Coverage |
|
|
@@ -170,7 +185,7 @@ To build and install from a source checkout:
|
|
|
170
185
|
npm ci
|
|
171
186
|
npm run check
|
|
172
187
|
npm pack
|
|
173
|
-
npm install --global ./shieldaai-security-watch-1.
|
|
188
|
+
npm install --global ./shieldaai-security-watch-1.4.0.tgz
|
|
174
189
|
```
|
|
175
190
|
|
|
176
191
|
Choose one setup command below. To start from your own code, use `init --project` as in [step 2](#get-started-in-four-steps). For a fictional example with AI disabled:
|
|
@@ -297,14 +312,22 @@ Run `security-watch providers` to list provider IDs, default endpoints, credenti
|
|
|
297
312
|
|
|
298
313
|
## Run with Docker
|
|
299
314
|
|
|
300
|
-
|
|
315
|
+
Each release is published as `ghcr.io/shieldaai/security-watch` for linux/amd64 and linux/arm64, with an SBOM and build provenance attached and a keyless Sigstore signature. Check it before you run it:
|
|
316
|
+
|
|
317
|
+
```sh
|
|
318
|
+
gh attestation verify oci://ghcr.io/shieldaai/security-watch:1.4.0 --repo ShieldaAI/security-watch
|
|
319
|
+
cosign verify ghcr.io/shieldaai/security-watch:1.4.0 \
|
|
320
|
+
--certificate-identity-regexp '^https://github.com/ShieldaAI/security-watch/' \
|
|
321
|
+
--certificate-oidc-issuer https://token.actions.githubusercontent.com
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Then:
|
|
301
325
|
|
|
302
326
|
```sh
|
|
303
|
-
docker build -t shielda-security-watch .
|
|
304
327
|
docker volume create security-watch-data
|
|
305
328
|
docker run --rm --user 0 --entrypoint chown \
|
|
306
329
|
--mount type=volume,src=security-watch-data,dst=/data \
|
|
307
|
-
|
|
330
|
+
ghcr.io/shieldaai/security-watch:1.4.0 "$(id -u):$(id -g)" /data
|
|
308
331
|
docker run --rm --name security-watch \
|
|
309
332
|
--user "$(id -u):$(id -g)" \
|
|
310
333
|
--read-only --cap-drop ALL --security-opt no-new-privileges \
|
|
@@ -313,9 +336,11 @@ docker run --rm --name security-watch \
|
|
|
313
336
|
--mount type=bind,src="$(pwd)/watch/security-watch.yaml",dst=/config/security-watch.yaml,readonly \
|
|
314
337
|
--mount type=bind,src="$(pwd)/watch/systems.yaml",dst=/config/systems.yaml,readonly \
|
|
315
338
|
--mount type=volume,src=security-watch-data,dst=/data \
|
|
316
|
-
|
|
339
|
+
ghcr.io/shieldaai/security-watch:1.4.0 start --config /config/security-watch.yaml
|
|
317
340
|
```
|
|
318
341
|
|
|
342
|
+
To build the image from a checkout instead, run `docker build -t ghcr.io/shieldaai/security-watch:1.4.0 .` first; the commands stay the same.
|
|
343
|
+
|
|
319
344
|
Before running, set `inventory: /config/systems.yaml` and `database: /data/watch.db` in the container's configuration. Create `watch/.env` privately with only the credentials you use; it is not loaded automatically by the npm CLI. Keep configuration, inventory and `.env` readable only by your user, for example with `chmod 600` on those files. The short initialization command assigns the data volume to your UID/GID; the application itself then runs as that user. Your Docker VM must be able to access the configuration/inventory bind mounts. Add a read-only mount under `/config` for any imported lockfile or SBOM folder (for example `--mount type=bind,src="$(pwd)/watch/sboms",dst=/config/sboms,readonly`) and use the matching path in the inventory.
|
|
320
345
|
|
|
321
346
|
SQLite stays on a native Docker volume rather than a desktop VM's shared host filesystem. This avoids depending on host-sharing behavior for database locking and write-ahead logging. Retain `security-watch-data` when recreating the container. The application needs outbound network access, and an inbound port only if you turn on the SBOM receiver (`intake`).
|
|
@@ -330,7 +355,7 @@ chmod 600 security-watch.yaml systems.yaml .env
|
|
|
330
355
|
export SECURITY_WATCH_UID=$(id -u) SECURITY_WATCH_GID=$(id -g)
|
|
331
356
|
```
|
|
332
357
|
|
|
333
|
-
Edit the copied inventory, notification routes and credentials, and apply the same `/config/systems.yaml` and `/data/watch.db` settings before running `docker compose up
|
|
358
|
+
Edit the copied inventory, notification routes and credentials, and apply the same `/config/systems.yaml` and `/data/watch.db` settings before running `docker compose up -d`, which pulls the published image. Inspect `docker compose logs --follow`. Compose requires the host UID/GID variables and automatically runs a short volume-ownership initializer before the application starts. Its `watch-data` named volume keeps SQLite on Docker's native filesystem, while the private configuration/inventory remain read-only host mounts. You may persist the UID/GID values in the private `.env` file for later Compose invocations. Add an explicit read-only mount if the inventory imports a lockfile or reads an SBOM folder (`- ./sboms:/config/sboms:ro`). Retain the named volume when recreating containers; `docker compose down --volumes` removes it.
|
|
334
359
|
|
|
335
360
|
## How decisions work
|
|
336
361
|
|
|
@@ -354,37 +379,39 @@ Models cannot run tools, change recipients, edit version ranges or establish tha
|
|
|
354
379
|
|
|
355
380
|
Commands that operate on a configured monitor accept `--config PATH`; the default is `./security-watch.yaml`. For monitor commands, add `--credentials-file PATH` to load a private dotenv file, or export variables through your service manager. The offline `rehearse` command rejects credential files and uses simulated delivery. Existing environment values take precedence for monitor commands. Files are parsed as data, without shell evaluation; they are never loaded implicitly. `init` uses `--directory` instead. Unsupported flag/command combinations are rejected before activity.
|
|
356
381
|
|
|
357
|
-
| Command | Behavior
|
|
358
|
-
| ------------------------------------------------------------------------------------------------- |
|
|
359
|
-
| `
|
|
360
|
-
| `
|
|
361
|
-
| `
|
|
362
|
-
| `
|
|
363
|
-
| `
|
|
364
|
-
| `
|
|
365
|
-
| `
|
|
366
|
-
| `
|
|
367
|
-
| `
|
|
368
|
-
| `scan
|
|
369
|
-
| `scan --
|
|
370
|
-
| `scan --
|
|
371
|
-
| `
|
|
372
|
-
| `
|
|
373
|
-
| `
|
|
374
|
-
| `
|
|
375
|
-
| `
|
|
376
|
-
| `
|
|
377
|
-
| `
|
|
378
|
-
| `
|
|
379
|
-
| `
|
|
380
|
-
| `
|
|
381
|
-
| `
|
|
382
|
-
| `
|
|
383
|
-
| `
|
|
384
|
-
| `
|
|
385
|
-
| `
|
|
386
|
-
| `
|
|
387
|
-
| `
|
|
382
|
+
| Command | Behavior |
|
|
383
|
+
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
384
|
+
| `check [PROJECT] [--base REF \| --package ECO:NAME@VER \| --advisory ID \| --sbom FILE]` | Check now, with no configuration: OSV and CISA KEV, nothing stored; exit 1 on a finding at or above `--fail-on` ([guide](docs/agents.md)) |
|
|
385
|
+
| `mcp [PROJECT]` | MCP server on stdio with the same checks and SBOM writing, for AI coding agents ([guide](docs/agents.md)) |
|
|
386
|
+
| `providers` | List supported provider profiles without configuration, credentials or network access |
|
|
387
|
+
| `templates` | List common system IDs available to `init --systems` |
|
|
388
|
+
| `ecosystems` | List supported library ecosystems |
|
|
389
|
+
| `sbom [--project PATH] [--output FILE]` | Read a project's lockfiles and manifests and write a CycloneDX SBOM; no network requests ([guide](docs/sbom.md)) |
|
|
390
|
+
| `upload --input FILE --url URL` | Send an SBOM to a monitor's receiver (`intake`); `sbom --upload URL` makes and sends one in a step |
|
|
391
|
+
| `import-sbom --input PATH` | Show what Security Watch reads from a CycloneDX or SPDX SBOM; exits 2 when some packages cannot be watched |
|
|
392
|
+
| `normalize-libraries --input PATH` | Parse a library list without network requests; optional `--ecosystem` sets the group and `--output` saves a new JSON file |
|
|
393
|
+
| `scan` | Run once, save evidence/findings and queue notifications; does not deliver by default |
|
|
394
|
+
| `scan --dry-run` | Use in-memory state, disable model calls and send no notifications; source requests still occur |
|
|
395
|
+
| `scan --notify` | Save a scan, attempt due delivery and report the remaining backlog; future or rate-limited jobs stay pending |
|
|
396
|
+
| `scan --fixture PATH` | Use local evidence instead of network sources and AI |
|
|
397
|
+
| `scan --no-ai` | Keep structured matching and disable model calls for this invocation |
|
|
398
|
+
| `start` | Run the scheduler and delivery worker in the foreground |
|
|
399
|
+
| `findings`, `status`, `deliveries`, `budget` | Inspect saved assessments, monitoring state, delivery outcomes and budget reservations |
|
|
400
|
+
| `health` | Check worker heartbeat, completed-scan freshness and actionable delivery problems; exits 2 when unhealthy |
|
|
401
|
+
| `health --scan-only` | Check completed scans and delivery without requiring a foreground worker, for external cron schedules |
|
|
402
|
+
| `reviews [--all] [--limit N] [--after CURSOR]` | Inspect the durable local AI dismissal queue and its backlog |
|
|
403
|
+
| `review FINDING_ID --revision N --disposition dismiss\|investigate --reviewer NAME --reason TEXT` | Adjudicate an exact current review locally without sending a notification |
|
|
404
|
+
| `explain FINDING_ID` | Show a finding, its current policy decision and acknowledgement/suppression controls |
|
|
405
|
+
| `history FINDING_ID` | Show saved finding revisions |
|
|
406
|
+
| `acknowledge FINDING_ID` | Acknowledge the current revision, or only revision N with `--revision N` |
|
|
407
|
+
| `suppress FINDING_ID --hours 24 --reason TEXT` | Suppress until an explicit expiry |
|
|
408
|
+
| `retry DELIVERY_ID` | Requeue a failed/uncertain delivery after checking receipt; does not send immediately |
|
|
409
|
+
| `backup --output PATH` | Create a consistent SQLite backup at a new destination and verify a temporary restored copy |
|
|
410
|
+
| `verify-backup --input PATH` | Verify a standalone backup without monitor configuration or replacing a live database |
|
|
411
|
+
| `prune` | Show a read-only plan using configured retention periods |
|
|
412
|
+
| `prune --apply` | Apply one bounded retention batch atomically |
|
|
413
|
+
| `unlock` | Remove stale lock metadata only when no worker owns the SQLite lock |
|
|
414
|
+
| `test-notification --channel slack` | Send an explicit test message; `email` is also supported |
|
|
388
415
|
|
|
389
416
|
Only one scan/scheduler instance may write a given database. Inspection and acknowledgement use SQLite safely alongside the worker. Do not share a database between containers or hosts or put it on a network filesystem. Stop the worker before replacing a database with a backup; retain permissions and move aside stale SQLite sidecar files with the old database.
|
|
390
417
|
|
|
@@ -425,11 +452,11 @@ The corpus contains source-derived synthetic scenarios with fictional inventorie
|
|
|
425
452
|
|
|
426
453
|
## Boundaries and privacy
|
|
427
454
|
|
|
428
|
-
cve.now stack queries disclose deduplicated npm package names and versions; lockfiles, SBOMs and deployment metadata are not uploaded. `security-watch sbom` makes no network requests. The Hacker News feed and article servers receive normal HTTP requests. Optional OSV queries also disclose dependency names and versions; optional GitHub, CISA and additional feed sources receive normal HTTP requests. GitHub authentication is optional. The selected model provider receives, under the default `minimal` disclosure profile, the matched package and product names and versions plus selected evidence; the `deployment-context` profile adds environment, exposure, criticality and matching keywords (see [SECURITY.md](SECURITY.md)). Slack/email receive findings and evidence links. Consider these disclosures before monitoring private dependencies.
|
|
455
|
+
`check` and the MCP server send package ecosystems, names and versions (and advisory IDs) to OSV, download the CISA known-exploited catalog, and send CVE IDs to FIRST only when EPSS is asked for; they store nothing. cve.now stack queries disclose deduplicated npm package names and versions; lockfiles, SBOMs and deployment metadata are not uploaded. `security-watch sbom` makes no network requests. The Hacker News feed and article servers receive normal HTTP requests. Optional OSV queries also disclose dependency names and versions; optional GitHub, CISA and additional feed sources receive normal HTTP requests. GitHub authentication is optional. The selected model provider receives, under the default `minimal` disclosure profile, the matched package and product names and versions plus selected evidence; the `deployment-context` profile adds environment, exposure, criticality and matching keywords (see [SECURITY.md](SECURITY.md)). Slack/email receive findings and evidence links. Consider these disclosures before monitoring private dependencies.
|
|
429
456
|
|
|
430
457
|
Authentication credentials are read from environment variables. Findings, evidence, quoted model output, budget reservations and history are stored locally. There is no automatic application telemetry. An explicitly configured heartbeat service receives success pings and normal request metadata. Protect the configuration, SQLite database, backups and credentials as operational data. Details are in [SECURITY.md](SECURITY.md).
|
|
431
458
|
|
|
432
|
-
This release has no automatic patching, shell execution from news, hosted dashboard, Slack action buttons, VEX import, operating-system package matching, distributed workers
|
|
459
|
+
This release has no automatic patching, shell execution from news, hosted dashboard, Slack action buttons, VEX import, operating-system package matching, distributed workers or independent security audit. CVSS v3.0/v3.1 vectors and supplied severity labels/scores are supported. OSV and GitHub also support [CVSS v4 base-vector scoring](docs/cvss-v4-support.md), with explicit base projection and unsupported-vector diagnostics. Product backports, reachability and exploit prerequisites require human/vendor evidence. cve.now starts from recent entries, revisits tracked/news-cited CVEs and checks exact npm packages through its stack endpoint; this is not an exhaustive historical audit of every product. Existing configurations retain explicitly enabled legacy sources; set `osv`, `github` and `kev` to `false` to switch exclusively to the new defaults.
|
|
433
460
|
|
|
434
461
|
Current evidence and findings are loaded into memory during each scan. Retention is disabled until configured, and protected unresolved records may continue growing even after cleanup is enabled. This release targets small installations. Plan storage and review retention dry runs before increasing scale.
|
|
435
462
|
|
package/SECURITY.md
CHANGED
|
@@ -34,6 +34,8 @@ Each configured AI model defaults to the `minimal` disclosure profile. It receiv
|
|
|
34
34
|
|
|
35
35
|
Inventory notes (the `note` field on systems, libraries and products) are the operator's own pointers to where something runs. They are stored in the local database and shown in notifications together with the system name and owner. They are never sent to advisory sources and are excluded from model requests under both disclosure profiles. Do not put secrets in a note.
|
|
36
36
|
|
|
37
|
+
`shield-candidates` prints system IDs and the same inventory names, owners and notes, plus package names, versions and advisory links, as local JSON. `--omit-location` leaves out system IDs (often a system's name), names, owners, notes, package URL qualifiers (which can name a private registry) and links to news articles (a feed can be internal); use it before giving the list to an agent or service outside your network. Identifiers, package names and versions stay, because a mitigation is written from them. `vex` writes package URLs from your inventory with only descriptive qualifiers (`classifier`, `type`, `arch`, `distro`, `os`, `epoch`), and its action statements can name your mitigation tool and host counts unless `--omit-mitigations` is given; read a document before you publish it. Mitigation status files are local files that Security Watch only reads; it connects to no Shirudo, ClickHouse or other mitigation service and holds no credential for one. `shirudo-sboms` reads a local copy of Shirudo's SBOM store, follows no symbolic links, and writes, replaces and removes only the files it marked as its own in the SBOM folder.
|
|
38
|
+
|
|
37
39
|
Notifications disclose formatted finding context, the inventory names and notes above, and source links to Slack or the configured email recipients under separate routing policy; model disclosure settings do not filter notification payloads or public inventory queries. There is no automatic application telemetry. An optional, operator-configured heartbeat endpoint receives bodyless success pings and normal request metadata. It receives no inventory, finding content or logs.
|
|
38
40
|
|
|
39
41
|
Credential values are read from environment variables, not placed in model prompts or intentionally persisted in SQLite. Do not insert keys into model names, feed URLs, inventory text or configuration substitutions. Use your service manager or secret manager to supply credentials; the CLI does not automatically load `.env` files. Do not commit configuration, database files, backups or `.env` files to source control.
|
|
@@ -48,9 +50,10 @@ SQLite stores evidence, finding revisions, model analysis excerpts, caches, budg
|
|
|
48
50
|
- CVSS v3.0/v3.1 calculation and supplied source labels/scores are supported. For OSV and GitHub records, CVSS v4 base vectors are scored with the pinned FIRST reference calculator; threat and environmental metrics are not applied, and unsupported vectors are counted and left unknown. See [CVSS v4 support](docs/cvss-v4-support.md).
|
|
49
51
|
- A package named only in the prose of a news story is matched by rules, not by understanding: a name that is an English word must be named as a package, carry a release or be written as a name, a scoped package is matched by its full name only, and a Maven library by its coordinates or by an artifact name that is not an English word. Stories about such packages can be missed and, less often, an unrelated story can match; see the [matching rules](docs/configuration.md#sources-and-coverage). Advisories are matched by structured package claims and are not affected.
|
|
50
52
|
- News signals (stated CVSS scores, vendor ratings and exploitation reports read from articles for findings without an advisory severity) are text matching, not verification. An article can be wrong, out of date or written to mislead, and every feed you add is trusted to say what it means: a feed that falsely reports exploitation of a product you list raises that finding to critical and, with `urgent_unknown`, sends it at once. Signals only raise priority; they never lower, dismiss or mark a finding as known exploited, and statements that cannot be tied to the finding's subject in their sentence or clause are not read. A feed can still raise every product it names in a report of exploitation, one clause at a time; add only feeds you trust. See [news signals](docs/configuration.md#news-signals).
|
|
53
|
+
- Mitigation status is the operator's file, read as written: Security Watch does not verify that a shield, policy or rule is loaded, signed or effective. It is shown only and never lowers a priority or closes a finding. `shield-candidates` readiness describes the information the advisories provide, not whether a mitigation is possible or safe, and fix links and exploit entries are only as complete as the advisories. `vex --include-not-affected` makes claims that other scanners act on by hiding the vulnerability; they rest on published version ranges. See [temporary mitigations](docs/mitigations.md).
|
|
51
54
|
- Source requests and model inputs have size and request limits. Incomplete collection or analysis reports degraded monitoring and requires review.
|
|
52
55
|
- Recent cve.now entry collection, tracked/news-cited refreshes and exact npm stack queries do not establish exhaustive historical coverage for every product. The recent listing is read one week past the checkpoint; a record cve.now ingests more than a week after its publication date is found only through an exact npm match or a news citation. The Hacker News may block article access; the feed excerpt remains available for review without a confident impact conclusion.
|
|
53
|
-
- CycloneDX JSON 1.
|
|
56
|
+
- CycloneDX JSON 1.2–1.7 (later 1.x with a notice) and SPDX JSON 2.2/2.3 package metadata import, and SBOM generation from lockfiles and manifests (`security-watch sbom`), are supported, and OpenVEX output (`vex`), but not VEX ingestion, operating-system package matching, attestation verification or live deployment discovery. There is no authenticated web crawling, automatic remediation, distributed lock, multi-host worker or independent penetration-test certification.
|
|
54
57
|
- Notifications are not exactly-once delivery. A timeout can occur after a destination accepts a message. Verify receipt before retrying an `unknown` job.
|
|
55
58
|
|
|
56
59
|
Review `status`, `deliveries`, source-health findings and service logs. Optional external success pings stop when monitoring is unhealthy, but the receiving service must be configured to detect missing pings. Loss of the host or every delivery channel cannot be reported through that same failed infrastructure.
|
package/dist/check.d.ts
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { type DependencyFile } from './manifests.js';
|
|
2
|
+
import type { EpssScore, HttpClient, Severity } from './types.js';
|
|
3
|
+
export interface CheckOptions {
|
|
4
|
+
/** Mark CISA known-exploited entries. Default: true. */
|
|
5
|
+
kev?: boolean;
|
|
6
|
+
/** Add FIRST EPSS scores to findings with a CVE. Sends CVE IDs to api.first.org. Default: false. */
|
|
7
|
+
epss?: boolean;
|
|
8
|
+
http?: HttpClient;
|
|
9
|
+
now?: number;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export interface ProjectCheckOptions extends CheckOptions {
|
|
13
|
+
/** A project folder or one dependency file. */
|
|
14
|
+
project?: string;
|
|
15
|
+
/** A CycloneDX or SPDX JSON SBOM to check instead of reading a project. */
|
|
16
|
+
sbom?: string;
|
|
17
|
+
/** Leave out development-only dependencies where the dependency file says which they are. */
|
|
18
|
+
production?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CheckFinding {
|
|
21
|
+
/** The advisory's own identifier (GHSA-, PYSEC-, RUSTSEC-, MAL- ...). */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Other identifiers of the same problem, such as its CVE. */
|
|
24
|
+
aliases: string[];
|
|
25
|
+
title: string;
|
|
26
|
+
/** Severity the advisory gives. */
|
|
27
|
+
severity: Severity;
|
|
28
|
+
/** Security Watch's priority: the severity, raised for known exploitation, malware or an unknown version. */
|
|
29
|
+
priority: Severity;
|
|
30
|
+
/** `affected`: the installed version is in an affected range. `unknown`: no exact version to compare. */
|
|
31
|
+
applicability: 'affected' | 'unknown';
|
|
32
|
+
/** Listed in CISA's Known Exploited Vulnerabilities catalog. */
|
|
33
|
+
exploited: boolean;
|
|
34
|
+
/** An OSV malicious-package record: the package itself is malware. */
|
|
35
|
+
malware: boolean;
|
|
36
|
+
package: {
|
|
37
|
+
ecosystem: string;
|
|
38
|
+
name: string;
|
|
39
|
+
version?: string;
|
|
40
|
+
};
|
|
41
|
+
/** Dependency files the package was found in, relative to the project. */
|
|
42
|
+
files: string[];
|
|
43
|
+
/** Versions that fix it, as the advisory gives them. */
|
|
44
|
+
fixed?: string;
|
|
45
|
+
url?: string;
|
|
46
|
+
epss?: EpssScore;
|
|
47
|
+
reasons: string[];
|
|
48
|
+
}
|
|
49
|
+
export interface CheckReport {
|
|
50
|
+
/** A project's dependency files, an SBOM file, or packages named in the request. */
|
|
51
|
+
kind: 'project' | 'sbom' | 'packages';
|
|
52
|
+
checked_at: string;
|
|
53
|
+
/** What was checked: a project folder, a file, an SBOM or a package list. */
|
|
54
|
+
target: string;
|
|
55
|
+
packages: number;
|
|
56
|
+
/** Packages without an exact version (a manifest without a lockfile): checked by name only. */
|
|
57
|
+
unversioned: number;
|
|
58
|
+
files: DependencyFile[];
|
|
59
|
+
ecosystems: string[];
|
|
60
|
+
findings: CheckFinding[];
|
|
61
|
+
/** Sources asked. */
|
|
62
|
+
sources: string[];
|
|
63
|
+
/** A source failed or answered in part: the findings may be incomplete. */
|
|
64
|
+
degraded: boolean;
|
|
65
|
+
errors: string[];
|
|
66
|
+
/** Dependency files that could not be read. Their packages were not checked, so `degraded` is set. */
|
|
67
|
+
warnings: string[];
|
|
68
|
+
/** Notes about what was read: version ranges, entries from Git or local paths, SBOM notices. */
|
|
69
|
+
notices: string[];
|
|
70
|
+
}
|
|
71
|
+
/** The reader's warnings that mean a file's packages are missing, rather than notes about them. */
|
|
72
|
+
export declare const isUnreadableWarning: (warning: string) => boolean;
|
|
73
|
+
/** A GET cache for the sources' static files (KEV, EPSS, OSV records), shared by checks in one session. */
|
|
74
|
+
export declare function cachingHttp(inner?: HttpClient, ttlMs?: number): HttpClient;
|
|
75
|
+
/**
|
|
76
|
+
* A git commit ID: 7 to 64 hex digits with at least one letter, or a full 40- or 64-digit ID.
|
|
77
|
+
* Date-style versions (org.json 20230227, pdfminer.six 20251107) are all digits and stay versions.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isCommitId(text: string): boolean;
|
|
80
|
+
/** A version that compares, or undefined: commit IDs and other text never pass for a version. */
|
|
81
|
+
export declare function comparable(version: string): string | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* The fixed versions worth showing, from an advisory's fix list ("1.2.6; 0.2.4, 1.2.6"): each once,
|
|
84
|
+
* in version order, without commit IDs, and, when the installed version is known, only those above
|
|
85
|
+
* it (an advisory for several release lines lists a fix per line, and "upgrade to 0.2.4" is no
|
|
86
|
+
* advice for 1.2.5). Versions that do not compare are kept as they are.
|
|
87
|
+
*/
|
|
88
|
+
export declare function fixesAbove(fix: string, installed: string | undefined): string | undefined;
|
|
89
|
+
/** Reads a project's dependency files (or an SBOM) and checks every package against OSV. */
|
|
90
|
+
export declare function checkProject(options?: ProjectCheckOptions): Promise<CheckReport>;
|
|
91
|
+
export interface PackageQuery {
|
|
92
|
+
ecosystem: string;
|
|
93
|
+
name: string;
|
|
94
|
+
/** Exact version. Without one, every advisory for the package is listed as `unknown`. */
|
|
95
|
+
version?: string;
|
|
96
|
+
}
|
|
97
|
+
/** Checks named packages, such as one an agent is about to add or upgrade to. */
|
|
98
|
+
export declare function checkPackages(packages: readonly PackageQuery[], options?: CheckOptions): Promise<CheckReport>;
|
|
99
|
+
export interface ChangeReport {
|
|
100
|
+
/** The ref as given; `REF...` means the point where the working tree's branch left REF. */
|
|
101
|
+
base: string;
|
|
102
|
+
/** The commit the base resolved to. */
|
|
103
|
+
commit: string;
|
|
104
|
+
head: CheckReport;
|
|
105
|
+
/** Findings the change brought in: the advisory did not concern this package at the base. */
|
|
106
|
+
added: CheckFinding[];
|
|
107
|
+
/** Findings at the base that the change removed. */
|
|
108
|
+
resolved: CheckFinding[];
|
|
109
|
+
/** Findings present before and after. */
|
|
110
|
+
unchanged: number;
|
|
111
|
+
packages: {
|
|
112
|
+
added: string[];
|
|
113
|
+
removed: string[];
|
|
114
|
+
changed: string[];
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Writes the dependency files of `project` as they were at `base` into a new temporary folder.
|
|
119
|
+
* Only files the project reader would pick up are taken, with `git cat-file`; nothing is checked
|
|
120
|
+
* out and no repository code runs. Submodules are not followed.
|
|
121
|
+
*/
|
|
122
|
+
export declare function dependencyFilesAt(project: string, base: string): {
|
|
123
|
+
folder: string;
|
|
124
|
+
project: string;
|
|
125
|
+
commit: string;
|
|
126
|
+
skipped: string[];
|
|
127
|
+
skippedPaths: string[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* The dependency files of the working tree that git tracks or would track: tracked files as they
|
|
131
|
+
* are on disk, and untracked files that are not ignored. Submodules, nested repositories and
|
|
132
|
+
* ignored folders are left out, as they are at the base.
|
|
133
|
+
*/
|
|
134
|
+
export declare function dependencyFilesInWorkingTree(project: string): {
|
|
135
|
+
folder: string;
|
|
136
|
+
project: string;
|
|
137
|
+
skipped: string[];
|
|
138
|
+
skippedPaths: string[];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Compares a project's dependencies at a git ref with the working tree and reports what the change
|
|
142
|
+
* added and fixed. Both sides are the files git knows: the base from its objects, the working tree
|
|
143
|
+
* as it is on disk (tracked, plus untracked files that are not ignored).
|
|
144
|
+
*/
|
|
145
|
+
export declare function checkChange(options: ProjectCheckOptions & {
|
|
146
|
+
base: string;
|
|
147
|
+
}): Promise<ChangeReport>;
|
|
148
|
+
export interface AdvisoryReport {
|
|
149
|
+
id: string;
|
|
150
|
+
/** The record was found in OSV. */
|
|
151
|
+
found: boolean;
|
|
152
|
+
title?: string;
|
|
153
|
+
summary?: string;
|
|
154
|
+
aliases: string[];
|
|
155
|
+
url?: string;
|
|
156
|
+
severity?: Severity;
|
|
157
|
+
/** Packages the advisory names, with their affected ranges and fixes. */
|
|
158
|
+
packages: Array<{
|
|
159
|
+
ecosystem: string;
|
|
160
|
+
name: string;
|
|
161
|
+
range?: string;
|
|
162
|
+
fixed?: string;
|
|
163
|
+
}>;
|
|
164
|
+
/** Findings in the project for this advisory (by its ID or an alias). */
|
|
165
|
+
findings: CheckFinding[];
|
|
166
|
+
/** Packages the advisory names that the project has, at versions it does not list as affected. */
|
|
167
|
+
present_not_affected: string[];
|
|
168
|
+
project: CheckReport;
|
|
169
|
+
}
|
|
170
|
+
/** CVE and GHSA identifiers in the case OSV uses; anything else as typed. */
|
|
171
|
+
export declare function normalizeAdvisoryId(value: string): string;
|
|
172
|
+
/**
|
|
173
|
+
* Answers "does this advisory concern the project?": looks the identifier up in OSV (CVE, GHSA,
|
|
174
|
+
* PYSEC, RUSTSEC, GO, MAL ...), follows aliases to the records that name packages, and checks
|
|
175
|
+
* the project.
|
|
176
|
+
*/
|
|
177
|
+
export declare function checkAdvisory(advisory: string, options?: ProjectCheckOptions): Promise<AdvisoryReport>;
|
|
178
|
+
/**
|
|
179
|
+
* Whether a finding fails a check at `failOn`. Malware always does. An installed version that is
|
|
180
|
+
* affected fails when it is known exploited or at or above the level. A package without an exact
|
|
181
|
+
* version ("check by hand") does not: nothing says the version in use is affected.
|
|
182
|
+
*/
|
|
183
|
+
export declare function failsAt(finding: CheckFinding, failOn: Severity | 'none'): boolean;
|
|
184
|
+
export declare function findingLine(finding: CheckFinding, kind?: CheckReport['kind']): string;
|
|
185
|
+
/**
|
|
186
|
+
* One line per package with several findings: the lowest listed fixed version that fixes all of
|
|
187
|
+
* them, each judged on its own release line, so that an agent upgrades once instead of once per
|
|
188
|
+
* finding. Nothing is said when no listed version fixes them all.
|
|
189
|
+
*/
|
|
190
|
+
export declare function upgradeSummary(findings: readonly CheckFinding[]): string[];
|
|
191
|
+
export declare function formatCheckReport(report: CheckReport, min?: Severity): string;
|
|
192
|
+
export declare function formatChangeReport(change: ChangeReport, min?: Severity): string;
|
|
193
|
+
export declare function formatAdvisoryReport(report: AdvisoryReport): string;
|