@shieldaai/security-watch 0.0.0-stage → 0.1.0-alpha.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 (62) hide show
  1. package/CONTRIBUTING.md +90 -0
  2. package/LICENSE +202 -0
  3. package/README.md +269 -2
  4. package/SECURITY.md +47 -0
  5. package/dist/assessment.d.ts +5 -0
  6. package/dist/assessment.js +398 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +792 -0
  9. package/dist/config.d.ts +242 -0
  10. package/dist/config.js +298 -0
  11. package/dist/cve-now.d.ts +5 -0
  12. package/dist/cve-now.js +413 -0
  13. package/dist/delivery.d.ts +26 -0
  14. package/dist/delivery.js +394 -0
  15. package/dist/ecosystems.d.ts +25 -0
  16. package/dist/ecosystems.js +254 -0
  17. package/dist/engine.d.ts +26 -0
  18. package/dist/engine.js +307 -0
  19. package/dist/health.d.ts +17 -0
  20. package/dist/health.js +70 -0
  21. package/dist/heartbeat.d.ts +13 -0
  22. package/dist/heartbeat.js +74 -0
  23. package/dist/http.d.ts +8 -0
  24. package/dist/http.js +251 -0
  25. package/dist/index.d.ts +18 -0
  26. package/dist/index.js +15 -0
  27. package/dist/inventory.d.ts +3 -0
  28. package/dist/inventory.js +143 -0
  29. package/dist/lock.d.ts +3 -0
  30. package/dist/lock.js +112 -0
  31. package/dist/maintenance.d.ts +43 -0
  32. package/dist/maintenance.js +227 -0
  33. package/dist/models.d.ts +20 -0
  34. package/dist/models.js +602 -0
  35. package/dist/operations.d.ts +17 -0
  36. package/dist/operations.js +117 -0
  37. package/dist/providers.d.ts +209 -0
  38. package/dist/providers.js +459 -0
  39. package/dist/setup.d.ts +113 -0
  40. package/dist/setup.js +100 -0
  41. package/dist/source-error.d.ts +22 -0
  42. package/dist/source-error.js +56 -0
  43. package/dist/sources.d.ts +3 -0
  44. package/dist/sources.js +1071 -0
  45. package/dist/store.d.ts +71 -0
  46. package/dist/store.js +651 -0
  47. package/dist/types.d.ts +247 -0
  48. package/dist/types.js +1 -0
  49. package/dist/util.d.ts +6 -0
  50. package/dist/util.js +14 -0
  51. package/dist/vendor-sources.d.ts +24 -0
  52. package/dist/vendor-sources.js +56 -0
  53. package/docs/configuration.md +406 -0
  54. package/docs/quality-review.md +104 -0
  55. package/examples/advisories.json +17 -0
  56. package/examples/common-systems.yaml +243 -0
  57. package/examples/libraries.example.txt +16 -0
  58. package/examples/libraries.example.yaml +38 -0
  59. package/examples/library-watch.example.yaml +27 -0
  60. package/examples/security-watch.example.yaml +86 -0
  61. package/examples/systems.example.yaml +31 -0
  62. package/package.json +69 -4
@@ -0,0 +1,90 @@
1
+ # Contributing
2
+
3
+ Security Watch uses TypeScript and requires Node.js 24 or newer. Keep source evidence, version applicability, contextual priority and notification policy separate when adding features.
4
+
5
+ ## Local development
6
+
7
+ ```sh
8
+ npm ci
9
+ npm run check
10
+ ```
11
+
12
+ `npm run build` cleans generated `dist` output and compiles with strict unused-code checks. `npm test` builds and runs the Node test suite. `npm run check` also checks formatting and verifies the packed package in a clean consumer. Use `npm run format` for consistent formatting; `npm pack` performs a fresh build. Tests should use synthetic data and injected HTTP/email clients; they must not require production model credentials, bill a provider or send Slack/email messages.
13
+
14
+ For an offline synthetic demonstration:
15
+
16
+ ```sh
17
+ npm run demo
18
+ ```
19
+
20
+ The demo loads `examples/systems.example.yaml` and `examples/advisories.json`, refreshes the synthetic timestamps, and makes no network, model or notification requests. For the fixture CLI itself, use `node dist/cli.js scan --config examples/security-watch.example.yaml --fixture examples/advisories.json --dry-run` after building. Dry runs disable models; tests of actual provider calls must retain budget accounting.
21
+
22
+ Do not commit `node_modules`, `dist`, generated tarballs, local configuration, real inventories, credentials or SQLite files. The project ignores common local paths, but inspect your diff before committing.
23
+
24
+ ## Live provider checks
25
+
26
+ The regular suite uses simulated provider responses, including real loopback HTTP tests for every provider profile. Live checks are separate and may incur provider charges. They send a short fictional bulletin through the production request, parsing and evidence-validation code, with no private inventory, tools or notifications.
27
+
28
+ Create a private `.env.live` file with the keys for the providers you want to test. Add exact model IDs available to your account:
29
+
30
+ ```dotenv
31
+ OPENAI_API_KEY=your-key
32
+ ANTHROPIC_API_KEY=your-key
33
+ SECURITY_WATCH_SMOKE_OPENAI_MODEL=your-openai-model-id
34
+ SECURITY_WATCH_SMOKE_ANTHROPIC_MODEL=your-claude-model-id
35
+ ```
36
+
37
+ ```sh
38
+ chmod 600 .env.live
39
+ npm run build
40
+ node --env-file=.env.live scripts/check-models.mjs --live --providers openai,anthropic
41
+ ```
42
+
43
+ If the variables are already exported, use `npm run check:models -- --live --providers openai,anthropic`. Omitting `--live` makes no requests. Each selected provider gets at most one request per invocation, with no automatic retry, a 30-second timeout and 1,024 output tokens by default. `--timeout-seconds` accepts 1–60 and `--max-output-tokens` accepts 128–2,048. Reservations are held in memory for this one-shot check; it does not use or change a monitor's persisted daily budget.
44
+
45
+ For other providers, use `SECURITY_WATCH_SMOKE_<PROVIDER>_MODEL`, replacing hyphens in the uppercase provider ID with underscores. `_ENDPOINT` selects a full endpoint, `_OUTPUT_FORMAT` selects an explicit format, and `_ALLOW_PRIVATE=1` permits an operator-selected private endpoint. Local profiles require an endpoint. Credential names come from `security-watch providers`.
46
+
47
+ The result reports passed, failed and skipped providers without raw model output or credentials. A pass confirms that one response met the application's schema and evidence checks; it does not measure general model accuracy. Exit status is 0 when at least one provider passes and none fail, 1 for failures, 2 for invalid options, and 3 when every provider is skipped. Missing credentials or configuration are reported as skips. Do not enable paid checks in routine CI.
48
+
49
+ ## Code layout
50
+
51
+ | Area | Responsibility |
52
+ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
53
+ | `src/config.ts`, `src/inventory.ts` | Configuration validation, path resolution and metadata-only inventory import |
54
+ | `src/http.ts`, `src/sources.ts`, `src/cve-now.ts` | Network restrictions, source collection, checkpoints and incomplete-source reporting |
55
+ | `src/assessment.ts` | Identity/version evidence, advisory grouping, per-deployment assessment and deterministic policy |
56
+ | `src/models.ts`, `src/providers.ts` | Provider protocols, bounded requests, evidence attribution, budgets and visible model failure |
57
+ | `src/store.ts`, `src/delivery.ts` | Transactional history/outbox, deduplication, acknowledgement, suppression and delivery status |
58
+ | `src/engine.ts`, `src/cli.ts` | Orchestration, persistent monitoring, useful health status and installation/operator workflows |
59
+
60
+ Keep provider and source schemas explicit. Do not accept a new service's response as trustworthy merely because it is syntactically valid. Unsupported affected-range formats must remain unknown. New inventory adapters must describe what their data actually establishes about deployment.
61
+
62
+ ## Pull requests
63
+
64
+ For behavioral changes, include a concise reproduction, before/after behavior, relevant tests and any change to coverage or privacy. Tests should exercise outcomes rather than mirror implementation details.
65
+
66
+ `main` and release branches require a pull request, resolved review conversations and passing CI against the latest base branch, including CodeQL. A sole maintainer may merge their own checked pull request; a second person's approval is not required. Direct pushes, force pushes, deletion and administrator bypass are blocked.
67
+
68
+ CI checks out source without saving its GitHub token and installs dependencies without lifecycle scripts. Pull requests also receive a dependency review. The CodeQL workflow scans TypeScript, JavaScript and GitHub Actions without building the project; Dependabot checks npm packages and pinned Actions weekly. New workflow checks must pass on GitHub before they become required merge checks.
69
+
70
+ Protect these invariants:
71
+
72
+ 1. Source-critical library/product findings cannot disappear because a model downgrades them or is unavailable.
73
+ 2. Missing configuration, stale versions, unsupported backports and no advisory matches never produce an unsupported safe result.
74
+ 3. Deployment-specific affected/fixed outcomes remain distinct; articles about multiple vulnerabilities must not merge unrelated advisories.
75
+ 4. Older source revisions cannot undo newer withdrawals or version evidence. Inventory changes reassess stored evidence.
76
+ 5. Malicious article/model text cannot change recipients, use tools or cause arbitrary network requests.
77
+ 6. Save findings and delivery jobs in the same transaction. If delivery may have succeeded, record it as uncertain and require a receipt check before retrying.
78
+ 7. Reserve model budget before each call, including verification. Restarting the process or receiving an error must not reset the budget.
79
+
80
+ Use fixture-based affected/fixed pairs, conflicting sources, malformed input, source/model failures and delivery interruption where relevant. Never publish real private inventory or a working credential in a test fixture.
81
+
82
+ ## Releases
83
+
84
+ The package is `@shieldaai/security-watch`; releases currently use the `alpha` tag. 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.
85
+
86
+ Only repository administrators can create `v*` release tags. These tags cannot be changed or deleted, including by administrators.
87
+
88
+ 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.
89
+
90
+ Security-sensitive reports should follow [SECURITY.md](SECURITY.md) rather than a public issue containing exploit details or secrets. Contributions use the repository's Apache-2.0 license.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 ShieldaAI contributors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,270 @@
1
- # Temporary Holding Version
1
+ # Shielda Security Watch
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An experimental TypeScript bot that compares security advisories and news with your system inventory, records its evidence, and routes findings to Slack or email.
4
+
5
+ **Alpha.** The package is `@shieldaai/security-watch`; prereleases use the `alpha` tag. See [coverage and security limits](SECURITY.md) before deploying it.
6
+
7
+ ## Features
8
+
9
+ - YAML/JSON inventories, library lists across 12 ecosystems, and npm package-lock v2/v3 imports. Names alone are accepted; exact installed versions improve applicability checks.
10
+ - 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.
11
+ - 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.
12
+ - Separate alert thresholds for libraries, products and news, plus review digests and configurable overrides for potentially critical findings, known exploitation and malware.
13
+ - Slack incoming webhooks and SMTP email, backed by a SQLite delivery queue. Uncertain delivery is recorded for manual review and retry.
14
+ - Finding history, acknowledgement, suppression with an expiry, source checkpoints and model budgets. Optional external heartbeats, bounded retention and verified backups support ongoing operation.
15
+
16
+ | Inventory item | Alpha coverage |
17
+ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
18
+ | npm package with an exact version | Match supported affected ranges or verified OSV query results; preserve uncertainty and conflicting sources |
19
+ | Library in another supported ecosystem | Exact positive OSV query or explicitly listed affected version; unsupported version ranges remain unknown |
20
+ | Library without an installed version | Discover advisory candidates by package identity; applicability remains unknown |
21
+ | npm package-lock v2/v3 | Import resolved transitive, development and optional dependency metadata; no installation or lifecycle scripts |
22
+ | Product, OS, database or SaaS name | Whole-name/keyword candidates plus AI news/impact assessment; **no general product-version, vendor-backport or SaaS configuration adapter** |
23
+ | Unknown or stale version | Review required; never infer safety from missing evidence |
24
+
25
+ `affected` means the declared package and installed version match supported advisory evidence. Only npm has version-range exclusion support; other ecosystems use exact positive OSV query results or explicitly listed affected versions. A missing version or empty search establishes neither affectedness nor safety. Lockfiles describe dependencies; you still need to verify what is deployed and reachable.
26
+
27
+ ## Install and preview
28
+
29
+ Use Node.js **24 or newer**. Install the alpha release:
30
+
31
+ ```sh
32
+ npm install --global @shieldaai/security-watch@alpha
33
+ ```
34
+
35
+ To build and install from a source checkout:
36
+
37
+ ```sh
38
+ npm ci
39
+ npm run check
40
+ npm pack
41
+ npm install --global ./shieldaai-security-watch-0.1.0-alpha.0.tgz
42
+ ```
43
+
44
+ Choose one setup command below. For a fictional example with AI disabled:
45
+
46
+ ```sh
47
+ security-watch init --directory ./watch --yes
48
+ ```
49
+
50
+ `init --yes` creates a private configuration, an example inventory and `.env.example`. It checks cve.now and The Hacker News every 30 minutes, with a 40-minute news window. AI and notification routes start disabled. Interactive `init` also asks for a provider, model, timing and notification channels. Existing files are never replaced.
51
+
52
+ Or start with Node.js, Python and OpenAI analysis:
53
+
54
+ ```sh
55
+ security-watch templates
56
+ security-watch init --directory ./watch --yes --systems nodejs,python \
57
+ --provider openai --model gpt-6-luna --poll-minutes 30 --lookback-minutes 40
58
+ ```
59
+
60
+ After either setup command, create the private environment file:
61
+
62
+ ```sh
63
+ cp ./watch/.env.example ./watch/.env
64
+ chmod 600 ./watch/.env
65
+ ```
66
+
67
+ If you enabled OpenAI, edit `watch/.env` to set `OPENAI_API_KEY`. Use an exact model ID available to your account; `security-watch providers` lists the supported providers and their credential names. Omit `--provider` and `--model` to start without AI. Local services also need `--endpoint` and `--allow-private-endpoint`.
68
+
69
+ To configure notifications during setup, add `--notifications slack` to `init`, or use `--notifications email --email-from alerts@example.com --email-to security@example.com`. `--notifications slack,email` configures both. Fill in `SLACK_WEBHOOK_URL` or `SMTP_URL` in the private credentials file. `doctor` lists the active routes and warns when notifications are disabled.
70
+
71
+ Replace the example inventory in `watch/systems.yaml`, then edit `watch/security-watch.yaml`. For system news analysis, enable `models`, set your exact analysis model ID and provide its credential through the named environment variable. Configure notification routes separately. Without AI, matching system names remain candidates requiring review; a mention alone does not prove impact. See the [configuration guide](docs/configuration.md).
72
+
73
+ [Common systems](examples/common-systems.yaml) provides a sample list of 24 runtimes, operating systems, databases and infrastructure products, including Node.js and Python. It leaves installed versions unspecified. Add your versions and deployment context before using it to assess impact; broad language names also match applications and incidental mentions.
74
+
75
+ ```sh
76
+ security-watch doctor --config ./watch/security-watch.yaml --credentials-file ./watch/.env
77
+ security-watch scan --config ./watch/security-watch.yaml --credentials-file ./watch/.env --dry-run
78
+ security-watch start --config ./watch/security-watch.yaml --credentials-file ./watch/.env
79
+ ```
80
+
81
+ `start` activates configured routes and stays in the foreground. Run it under your service manager or Docker for continuous operation.
82
+
83
+ Verify a destination with `security-watch test-notification --channel slack --config ./watch/security-watch.yaml --credentials-file ./watch/.env`; use `--channel email` for SMTP. Each invocation sends one explicit test, reports acceptance or a safe failure reason, and leaves the monitor database unchanged.
84
+
85
+ To scan every 30 minutes and discover news from the last 40 minutes, set:
86
+
87
+ ```yaml
88
+ poll_interval_minutes: 30
89
+ news_lookback_minutes: 40
90
+ ```
91
+
92
+ Overlapping scans deduplicate findings. After downtime, the worker catches up from the last successful source checkpoint; older tracked advisories and exact package matches remain in scope. See [scan schedules and news windows](docs/configuration.md#scan-schedule-and-news-window).
93
+
94
+ `doctor` validates local configuration and required environment variables. It does not contact providers, validate a model by spending tokens, or send test messages. A dry run writes no application state, disables model calls and sends no notifications; public advisory/feed requests still occur. For an offline demonstration, run:
95
+
96
+ ```sh
97
+ npm run demo
98
+ ```
99
+
100
+ The demo refreshes synthetic inventory timestamps and uses in-memory state, with no network, models or messages. The underlying files are [example configuration](examples/security-watch.example.yaml), [example inventory](examples/systems.example.yaml) and [synthetic evidence](examples/advisories.json). You can also run:
101
+
102
+ ```sh
103
+ security-watch scan --config examples/security-watch.example.yaml --fixture examples/advisories.json --dry-run
104
+ ```
105
+
106
+ Fixture mode makes no source or AI requests. Do not combine a fixture with `--notify` unless you intend to send its synthetic findings. To test model analysis, run `security-watch scan --config ./watch/security-watch.yaml --credentials-file ./watch/.env` without `--dry-run` or `--notify`. This saves findings and budget reservations and may incur provider charges; it does not deliver notifications. The checkout also includes an opt-in [synthetic provider check](CONTRIBUTING.md#live-provider-checks).
107
+
108
+ ## Library inventories
109
+
110
+ The supported ecosystems are npm, PyPI, Packagist, Go, Maven, crates.io, RubyGems, NuGet, Hex, Pub, Hackage and SwiftURL. Common language names such as `python`, `php` and `rust` are accepted as aliases. Run `security-watch ecosystems` for the canonical names.
111
+
112
+ Start from a file with one library per line:
113
+
114
+ ```text
115
+ npm:express
116
+ python:requests
117
+ python:urllib3==2.2.3
118
+ php:symfony/http-foundation@6.4.0
119
+ maven:org.apache.logging.log4j:log4j-core
120
+ ```
121
+
122
+ These are examples, not version recommendations. Use the registry's published package spelling, especially for NuGet. Omit a version you have not verified; do not substitute `latest`, a version constraint or a guessed release.
123
+
124
+ ```sh
125
+ security-watch normalize-libraries --input ./libraries.txt
126
+ security-watch init --directory ./watch --yes --libraries ./libraries.txt
127
+ ```
128
+
129
+ For a list containing only one ecosystem, use names without prefixes and add `--ecosystem php` or another supported alias. `init --libraries` creates one application inventory and enables OSV. It cannot be combined with `--systems`. Structured library matching needs no AI or model credentials. For a library-only monitor, disable news sources; see the [library configuration](examples/library-watch.example.yaml), [grouped inventory](examples/libraries.example.yaml) and [mixed library list](examples/libraries.example.txt).
130
+
131
+ To include official release/security news, add `--vendor-feeds nodejs,python,php` during setup or set `sources.vendor_feeds` in the configuration. These adapters extract bounded article text from fixed vendor hosts. A release announcement or database publication date alone does not establish a new vulnerability.
132
+
133
+ ## LLM providers
134
+
135
+ There are 22 provider profiles:
136
+
137
+ - OpenAI, Azure OpenAI, Anthropic (Claude), Google Gemini, Cohere, xAI and Perplexity use their provider APIs.
138
+ - Groq, DeepSeek, Mistral, Together AI, Fireworks AI, OpenRouter, Cerebras, NVIDIA, SambaNova and Hugging Face use hosted Chat Completions endpoints.
139
+ - Ollama, LM Studio, vLLM and LiteLLM support configured local servers or gateways. A generic `openai-compatible` profile accepts other Chat Completions endpoints.
140
+
141
+ Run `security-watch providers` to list provider IDs, default endpoints, credential variable names and API documentation without loading a monitor configuration. Specify an exact model ID and choose a supported output format; capabilities vary by model and account. Local/private endpoints require explicit configuration. AWS Bedrock and Vertex AI credentials are not supported directly. See [provider configuration](docs/configuration.md#model-configuration) for defaults and examples.
142
+
143
+ ## Run with Docker
144
+
145
+ Build the image locally:
146
+
147
+ ```sh
148
+ docker build -t shielda-security-watch .
149
+ docker volume create security-watch-data
150
+ docker run --rm --user 0 --entrypoint chown \
151
+ --mount type=volume,src=security-watch-data,dst=/data \
152
+ shielda-security-watch "$(id -u):$(id -g)" /data
153
+ docker run --rm --name security-watch \
154
+ --user "$(id -u):$(id -g)" \
155
+ --env-file ./watch/.env \
156
+ --mount type=bind,src="$(pwd)/watch/security-watch.yaml",dst=/config/security-watch.yaml,readonly \
157
+ --mount type=bind,src="$(pwd)/watch/systems.yaml",dst=/config/systems.yaml,readonly \
158
+ --mount type=volume,src=security-watch-data,dst=/data \
159
+ shielda-security-watch start --config /config/security-watch.yaml
160
+ ```
161
+
162
+ 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 for any imported lockfile under `/config` and use the matching path in the inventory.
163
+
164
+ 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 no inbound port.
165
+
166
+ The included Compose file uses root-level `security-watch.yaml`, `systems.yaml` and `.env`:
167
+
168
+ ```sh
169
+ cp examples/security-watch.example.yaml security-watch.yaml
170
+ cp examples/systems.example.yaml systems.yaml
171
+ cp .env.example .env
172
+ chmod 600 security-watch.yaml systems.yaml .env
173
+ export SECURITY_WATCH_UID=$(id -u) SECURITY_WATCH_GID=$(id -g)
174
+ ```
175
+
176
+ 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 --build -d`. 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. Retain the named volume when recreating containers; `docker compose down --volumes` removes it.
177
+
178
+ ## How decisions work
179
+
180
+ 1. Collect cve.now responses and The Hacker News articles within configured size and request limits. Preserve source revisions and group advisories that share verified aliases. News mentioning several existing advisories adds context to each finding separately.
181
+ 2. Compare each deployment's library identity and declared version. npm supports range checks; other ecosystems require exact positive evidence. Generic product matches remain uncertain. Stale inventory cannot support a safe conclusion.
182
+ 3. Ask the configured model to classify matched system news and assess the claimed impact on the declared deployment, using article evidence and version context. General news about a system is distinguished from a new vulnerability or an update to a known one. If configured, a second model reviews every news analysis and any critical, exploited, uncertain or conflicting finding. Disagreements remain visible.
183
+ 4. Apply the category's notification policy. AI cannot reduce priority below the source severity or suppress a critical library/product finding. News with an advisory identifier and an exact installed package mention uses library policy even before structured advisory data arrives.
184
+ 5. Commit finding changes and notification jobs together. Deliver meaningful changes without treating cosmetic article wording or AI phrasing as new events.
185
+
186
+ With the default rules, libraries select critical severity and products/news select high or critical; routes are empty until configured. Unknown/conflicting potentially critical findings notify immediately when `urgent_unknown` is enabled. Lower-priority uncertainty goes to a review digest. Known-exploitation and malicious-package overrides are separately configurable. A category with no channels sends nothing, including overrides.
187
+
188
+ For system news, the model records `new_vulnerability`, `known_vulnerability_update`, `general_news` or `unknown`, alongside its assessment of system impact. General coverage and supported exclusions are recorded without a vulnerability alert; uncertain analysis goes to review. A vulnerability that the model believes affects the system follows your severity policy. These rules also cover product articles linked to collected CVEs. Critical-source severity, configured exploitation overrides and deterministic library matches still take precedence. See [model configuration](docs/configuration.md#model-configuration) for evidence and version requirements.
189
+
190
+ General-news classifications remain in history after a story leaves RSS. Changes to the article, inventory or model settings trigger reassessment. Affected or excluded impact claims require fresh evidence.
191
+
192
+ Models cannot run tools, change recipients, edit version ranges or establish that a dependency is safe. Model outages and exhausted budgets retain deterministic results and create monitoring-health findings. There is no automatic provider fallback.
193
+
194
+ ## Operate
195
+
196
+ Commands that operate on a configured monitor accept `--config PATH`; the default is `./security-watch.yaml`. Add `--credentials-file PATH` to load a private dotenv file, or export variables through your service manager. Existing environment values take precedence. 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.
197
+
198
+ | Command | Behavior |
199
+ | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
200
+ | `providers` | List supported provider profiles without configuration, credentials or network access |
201
+ | `templates` | List common system IDs available to `init --systems` |
202
+ | `ecosystems` | List supported library ecosystems |
203
+ | `normalize-libraries --input PATH` | Parse a library list without network requests; optional `--ecosystem` sets the group and `--output` saves a new JSON file |
204
+ | `scan` | Run once, save evidence/findings and queue notifications; does not deliver by default |
205
+ | `scan --dry-run` | Use in-memory state, disable model calls and send no notifications; source requests still occur |
206
+ | `scan --notify` | Save a scan, attempt due delivery and report the remaining backlog; future or rate-limited jobs stay pending |
207
+ | `scan --fixture PATH` | Use local evidence instead of network sources and AI |
208
+ | `scan --no-ai` | Keep structured matching and disable model calls for this invocation |
209
+ | `start` | Run the scheduler and delivery worker in the foreground |
210
+ | `findings`, `status`, `deliveries`, `budget` | Inspect saved assessments, monitoring state, delivery outcomes and budget reservations |
211
+ | `health` | Check worker heartbeat, completed-scan freshness and actionable delivery problems; exits 2 when unhealthy |
212
+ | `health --scan-only` | Check completed scans and delivery without requiring a foreground worker, for external cron schedules |
213
+ | `explain FINDING_ID` | Show a finding, its current policy decision and acknowledgement/suppression controls |
214
+ | `history FINDING_ID` | Show saved finding revisions |
215
+ | `acknowledge FINDING_ID` | Acknowledge the current revision; a material change creates a new revision |
216
+ | `suppress FINDING_ID --hours 24 --reason TEXT` | Suppress until an explicit expiry |
217
+ | `retry DELIVERY_ID` | Requeue a failed/uncertain delivery after checking receipt; does not send immediately |
218
+ | `backup --output PATH` | Create a consistent SQLite backup at a new destination and verify a temporary restored copy |
219
+ | `verify-backup --input PATH` | Verify a standalone backup without monitor configuration or replacing a live database |
220
+ | `prune` | Show a read-only plan using configured retention periods |
221
+ | `prune --apply` | Apply one bounded retention batch atomically |
222
+ | `unlock` | Remove stale lock metadata only when no worker owns the SQLite lock |
223
+ | `test-notification --channel slack` | Send an explicit test message; `email` is also supported |
224
+
225
+ 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.
226
+
227
+ Digests use fixed UTC epoch-aligned time buckets, defaulting to midnight UTC, with at most five findings per delivery. Larger digests produce multiple messages. `scan --notify` does not wait for future digest times, retry timers or Slack rate limits; it prints the remaining backlog. Use `start` to keep draining the queue as jobs become due. Urgent deterministic results are attempted before optional AI work.
228
+
229
+ A notification marked `accepted` was accepted by the destination, not necessarily read. Interrupted or ambiguous delivery becomes `unknown`: inspect the destination before `retry`, because it may already have arrived. Automatic retries cover explicit transient rejections and DNS/connection failures known to occur before sending. Slack digests split to fit the message limit, and one malformed queued message does not block healthy messages. Delivery state remains available even when a destination fails.
230
+
231
+ `scan` exits with status 2 for degraded monitoring or failed/uncertain delivery, including an early urgent delivery attempt; setup/command failures use status 1. `health` is read-only, makes no network requests, and reports monitoring health rather than whether systems are secure. The Compose service includes this health check. Check `status`, service logs and delivery state rather than treating an empty findings list as an all-clear.
232
+
233
+ One failed source item, model response or notification does not stop unrelated work. Valid evidence and findings are saved, incomplete sources keep their previous checkpoints, and `start` continues scheduled scans and due deliveries. A one-shot `scan` finishes its work and reports degraded status; it does not stay running. Cancellation and failures that prevent reliable database writes still stop the worker.
234
+
235
+ SIGTERM/SIGINT cancels source/model requests and active delivery attempts, then stops further work. Interrupted or ambiguous receipt remains explicit. Before urgent sends, inventory exclusions, withdrawals and removals are reconciled. Every delivery rechecks current routing policy.
236
+
237
+ ### Heartbeats, retention and backups
238
+
239
+ All three are opt-in. `init --heartbeat` adds an external success-ping route using the `HEARTBEAT_URL` environment variable. Configure the receiving service to alert when pings stop. The worker sends a bodyless request only while monitoring health is healthy; failed scans or delivery problems withhold success pings. This is separate from the local `health` command and sends no inventory or logs.
240
+
241
+ Configure `maintenance.retention`, inspect `security-watch prune --config PATH`, then use `--apply` for one cleanup batch. Once configured, `start` also applies retention on the maintenance schedule. Active or uncertain findings, unresolved deliveries, source checkpoints and budget records remain protected. Expiring an inactive finding requires a supported exclusion, withdrawal or confirmed general-news result; removing a system from inventory is not enough.
242
+
243
+ `maintenance.backup` schedules private snapshots, verifies them before rotation, and keeps the configured number. When both are enabled, a verified backup precedes pruning. `verify-backup` tests schema migration and structural restoration in a temporary copy; it does not prove that stored security claims are correct. See [maintenance configuration](docs/configuration.md#retention-and-verified-backups) before enabling either policy.
244
+
245
+ ### Model evaluation from a checkout
246
+
247
+ ```sh
248
+ npm run evaluate:models -- --help
249
+ npm run evaluate:models
250
+ ```
251
+
252
+ Without `--live`, the script makes no provider calls and reports skipped cases. To run it, supply provider credentials and exact `SECURITY_WATCH_EVAL_<PROVIDER>_MODEL` values in the environment, then choose providers and a request cap:
253
+
254
+ ```sh
255
+ npm run evaluate:models -- --live --providers openai,anthropic --max-requests 20
256
+ ```
257
+
258
+ The corpus contains source-derived synthetic scenarios with fictional inventories. Its reference labels are marked `pending_human_review`. Reports distinguish output acceptance, coverage, label agreement, false exclusions, rejected outputs and model disagreements. Label agreement is not measured production accuracy. Live runs may incur charges, use a total request cap, and send no notifications; full options are in the script help.
259
+
260
+ ## Boundaries and privacy
261
+
262
+ cve.now stack queries disclose deduplicated npm package names and versions; lockfiles and deployment metadata are not uploaded. 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 relevant components/products/keywords and deployment context from the matched system, plus selected evidence. Slack/email receive findings and evidence links. Consider these disclosures before monitoring private dependencies.
263
+
264
+ 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).
265
+
266
+ This alpha has no automatic patching, shell execution from news, hosted dashboard, Slack action buttons, general SBOM import, distributed workers, EPSS integration or independent security audit. CVSS v3.0/v3.1 vectors and supplied severity labels/scores are supported; there is no CVSS v4 calculator. 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.
267
+
268
+ 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 alpha targets small installations. Plan storage and review retention dry runs before increasing scale.
269
+
270
+ See the [configuration guide](docs/configuration.md), [security policy](SECURITY.md) and [contributing guide](CONTRIBUTING.md). Licensed under Apache-2.0.