@shieldaai/security-watch 1.1.0 → 1.1.1

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 CHANGED
@@ -2,6 +2,17 @@
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.1.1
6
+
7
+ Fixes for feeds that were read wrongly and for two checks that trusted a name. No configuration change. To be published under the default `latest` tag; the GitHub Action is used as `uses: ShieldaAI/security-watch@v1.1.1`.
8
+
9
+ ### Fixed
10
+
11
+ - **Feeds with an image in `<media:content>` were read without their text.** The article in `<description>` was ignored whenever an item also had a `<media:content>` element, so every item from feeds such as Rapid7's blog and Dark Reading arrived with an empty description and could match only by its title. The first of `content:encoded`, `content`, `description` and `summary` that holds text is now used. An empty `content:encoded` also falls through to the description.
12
+ - **Feeds that escape their HTML with entities showed the tags as text.** A description written as `&lt;p&gt;` (Tenable's blog, the seclists.org lists) arrived as the literal text `<p>`, `<br>` and similar, which reached matching, models and alerts. A field that carries HTML (RSS `description` and `content:encoded`, Atom `content` and `summary` with `type="html"`) and holds no raw `<`, which escaped XML text never does, is now unescaped once as XML (the five predefined entities and character references only; DTDs are still refused) before it is read as HTML. CDATA and plain-text fields (titles, Atom text content) are read as before, so `&lt;script&gt;` in a title stays text. The first scan after the upgrade records a new revision of items from such feeds that are still in the news window.
13
+ - **A name that starts like a loopback address no longer counts as one.** `intake.listen: 127.example.com:8787` was accepted without TLS or `allow_plain_http`, because the check read the text of the host. Only `localhost`, an IPv4 address in 127.0.0.0/8 and the IPv6 loopback address count now.
14
+ - **`sbom --project FILE` refuses a symbolic link.** A link named like a dependency file was followed to whatever it pointed at, unlike files found inside a project folder, which were already skipped. A project folder given as a link is still read.
15
+
5
16
  ## 1.1.0
6
17
 
7
18
  Start from your code instead of a hand-written inventory, and keep the inventory current from CI. 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.1.0`.
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.1.0
89
+ - uses: ShieldaAI/security-watch@v1.1.1
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.1.0 sbom --system-id my-app --upload https://watch.example.com:8787
99
+ npx --yes @shieldaai/security-watch@1.1.1 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,7 +130,7 @@ 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.1.0.** This is `@shieldaai/security-watch` 1.1.0, a minor release of the first stable version (1.0.0) that adds SBOM generation from dependency files, 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.
133
+ **Version 1.1.1.** This is `@shieldaai/security-watch` 1.1.1, a patch release of 1.1.0, the minor release of the first stable version (1.0.0) that added SBOM generation from dependency files, 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
 
@@ -170,7 +170,7 @@ To build and install from a source checkout:
170
170
  npm ci
171
171
  npm run check
172
172
  npm pack
173
- npm install --global ./shieldaai-security-watch-1.1.0.tgz
173
+ npm install --global ./shieldaai-security-watch-1.1.1.tgz
174
174
  ```
175
175
 
176
176
  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:
package/dist/config.js CHANGED
@@ -241,7 +241,10 @@ export const configSchema = z
241
241
  path: ['tls_cert_file'],
242
242
  });
243
243
  const host = intake.listen.slice(0, intake.listen.lastIndexOf(':')).replace(/^\[|\]$/g, '');
244
- const loopback = host === 'localhost' || host === '::1' || /^127\./.test(host);
244
+ // An address, not a name that starts like one: `127.example.com` can point anywhere.
245
+ const loopback = host.toLowerCase() === 'localhost' ||
246
+ (isIP(host) === 4 && host.startsWith('127.')) ||
247
+ (isIP(host) === 6 && /^(?:0*:)*:?0*1$/.test(host));
245
248
  if (!loopback && !intake.tls_cert_file && !intake.allow_plain_http)
246
249
  ctx.addIssue({
247
250
  code: 'custom',
package/dist/manifests.js CHANGED
@@ -892,6 +892,10 @@ export const DEPENDENCY_FILES = {
892
892
  /** Walks a project for dependency files without following links or entering installed-package folders. */
893
893
  function discover(root, warnings) {
894
894
  const stat = statSync(root);
895
+ // A link named like a dependency file can point at any file on the machine. The folder given as
896
+ // the project may be a link (the user chose it); a file must be the file itself.
897
+ if (stat.isFile() && lstatSync(root).isSymbolicLink())
898
+ throw new Error(`${basename(root)} is a symbolic link; give the dependency file itself.`);
895
899
  if (stat.isFile()) {
896
900
  const kind = classify(basename(root), basename(dirname(root)));
897
901
  if (!kind)
package/dist/sources.js CHANGED
@@ -1250,8 +1250,37 @@ function htmlText(root, limit = 16_000) {
1250
1250
  // Entity references have already been decoded once by the HTML parser.
1251
1251
  return cleanText(parts.join(' ').replace(/\s+/g, ' ').trim(), limit);
1252
1252
  }
1253
- function plainText(value, limit = 16_000) {
1254
- return htmlText(parseHtml(xmlText(value)), limit);
1253
+ /**
1254
+ * A feed value read as plain text. Only for values parsed by `feed()`, which leaves entity
1255
+ * references alone (`processEntities: false`), so the HTML parser decodes them once.
1256
+ *
1257
+ * With `html`, the field carries HTML (RSS `description` and `content:encoded`, Atom `content` and
1258
+ * `summary` with `type="html"`). A publisher may escape that HTML with entities (`&lt;p&gt;`)
1259
+ * instead of wrapping it in CDATA; escaped XML text can never hold a raw `<`, so a value without
1260
+ * one is unescaped once as XML before it is read as HTML. Plain-text fields (titles, Atom text
1261
+ * content) are read as before: `&lt;script&gt;` in a title is text, not a tag.
1262
+ */
1263
+ function plainText(value, limit = 16_000, html = false) {
1264
+ const raw = xmlText(value);
1265
+ return htmlText(parseHtml(html && !raw.includes('<') ? xmlUnescape(raw) : raw), limit);
1266
+ }
1267
+ /** Whether a feed field carries HTML: its `type` attribute when it has one (Atom), else the default. */
1268
+ function htmlField(value, otherwise) {
1269
+ const type = value && typeof value === 'object' && !Array.isArray(value)
1270
+ ? value['@_type']
1271
+ : undefined;
1272
+ return typeof type === 'string' ? type.toLowerCase() === 'html' : otherwise;
1273
+ }
1274
+ /** The five predefined XML entities and character references; nothing that a DTD could declare. */
1275
+ function xmlUnescape(value) {
1276
+ return value.replace(/&(?:(lt|gt|amp|quot|apos)|#(\d{1,7})|#x([\da-f]{1,6}));/gi, (match, name, decimal, hex) => {
1277
+ if (name)
1278
+ return { lt: '<', gt: '>', amp: '&', quot: '"', apos: "'" }[name.toLowerCase()];
1279
+ const point = decimal ? Number(decimal) : Number.parseInt(hex, 16);
1280
+ return point > 0 && point <= 0x10ffff && (point < 0xd800 || point > 0xdfff)
1281
+ ? String.fromCodePoint(point)
1282
+ : match;
1283
+ });
1255
1284
  }
1256
1285
  function list(value) {
1257
1286
  return value === undefined ? [] : Array.isArray(value) ? value : [value];
@@ -1350,7 +1379,20 @@ async function feed(url, source, http, now, window, entryLimit = MAX_FEED_ENTRIE
1350
1379
  const title = plainText(entry.title, 500);
1351
1380
  if (!title)
1352
1381
  throw new SourceError('Feed entry is missing its title.');
1353
- const description = plainText(entry.encoded ?? entry.content ?? entry.description ?? entry.summary ?? '');
1382
+ // The first field that holds text. An element can be present and empty: `<media:content>`
1383
+ // (an image, read as `content` once namespace prefixes are removed) beside the article in
1384
+ // `<description>`, or an empty `<content:encoded>`.
1385
+ let description = '';
1386
+ for (const [field, html] of [
1387
+ [entry.encoded, true],
1388
+ [entry.content, htmlField(entry.content, false)],
1389
+ [entry.description, true],
1390
+ [entry.summary, htmlField(entry.summary, false)],
1391
+ ]) {
1392
+ description = plainText(field, 16_000, html);
1393
+ if (description)
1394
+ break;
1395
+ }
1354
1396
  const links = list(entry.link);
1355
1397
  const selectedLink = links.find((link) => typeof link === 'string' || !record(link)['@_rel'] || record(link)['@_rel'] === 'alternate');
1356
1398
  const rawLink = typeof selectedLink === 'object' && selectedLink !== null
@@ -4,7 +4,7 @@ Security Watch compares a system inventory with advisory evidence and records
4
4
  why a finding applies. Begin with its published fictional inventory and advisory
5
5
  fixture, then inspect the result before configuring real monitoring.
6
6
 
7
- This example uses `@shieldaai/security-watch@1.1.0`, an in-memory database,
7
+ This example uses `@shieldaai/security-watch@1.1.1`, an in-memory database,
8
8
  no provider credentials and no notification delivery. It is a fixture check of
9
9
  matching behavior, not an audit of real dependencies.
10
10
 
@@ -16,7 +16,7 @@ Use Node.js 24.10 or newer in a new directory:
16
16
  mkdir watch-demo
17
17
  cd watch-demo
18
18
  npm init -y
19
- npm install --ignore-scripts --save-exact @shieldaai/security-watch@1.1.0
19
+ npm install --ignore-scripts --save-exact @shieldaai/security-watch@1.1.1
20
20
  ```
21
21
 
22
22
  ## Run the fictional inventory
package/docs/sbom.md CHANGED
@@ -127,7 +127,7 @@ jobs:
127
127
  steps:
128
128
  - uses: actions/checkout@v7
129
129
  - id: sbom
130
- uses: ShieldaAI/security-watch@v1.1.0
130
+ uses: ShieldaAI/security-watch@v1.1.1
131
131
  with:
132
132
  system-id: checkout-api
133
133
  owner: Dana, platform team
@@ -143,7 +143,7 @@ To use an SBOM made by another tool, pass it as `sbom-file`; the action checks t
143
143
 
144
144
  ```yaml
145
145
  - run: trivy image --format cyclonedx --output image.cdx.json "$IMAGE"
146
- - uses: ShieldaAI/security-watch@v1.1.0
146
+ - uses: ShieldaAI/security-watch@v1.1.1
147
147
  with:
148
148
  sbom-file: image.cdx.json
149
149
  system-id: checkout-image
@@ -160,7 +160,7 @@ Any job with Node.js 24.10 or newer can run the command:
160
160
  security-watch-sbom:
161
161
  image: node:24-slim
162
162
  script:
163
- - npx --yes @shieldaai/security-watch@1.1.0 sbom --system-id checkout-api --output security-watch.cdx.json --upload https://watch.example.com:8787
163
+ - npx --yes @shieldaai/security-watch@1.1.1 sbom --system-id checkout-api --output security-watch.cdx.json --upload https://watch.example.com:8787
164
164
  artifacts:
165
165
  paths: [security-watch.cdx.json]
166
166
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shieldaai/security-watch",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Self-hosted security alerts for the software you run: reads your lockfiles (npm, Python, Go, Rust, Java and 7 more ecosystems) or any SBOM, watches new advisories and security news, and alerts you on Slack or email.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",