From 2438e80a156ccb289a8da3359744675c5030e8f2 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 20:32:17 -0400 Subject: [PATCH 1/2] fix: triage security scan findings and release 0.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Independently re-verified all three findings in docs/securityscan.md against the code and the live dependency tree. Finding 1 (dev-only azurite advisories) is valid and now partially remediated: `uuid` is pinned to ^11.1.1 through a root `overrides` entry, clearing GHSA-w5hq-g745-h8pq, with a lockfile regression test. The `brace-expansion` and `@opentelemetry/core` advisories are documented as accepted because each one's only patched release is API-incompatible with the tree azurite pins: brace-expansion@5.0.8 exports a named `expand` rather than a callable module, so minimatch@3 throws `expand is not a function`; and @opentelemetry/core@2.x removes `TracesSamplerValues.AlwaysOn`, which applicationinsights' pinned sdk-trace-base@1.30.1 reads, so tracer construction throws. The latter fails latently — the package still loads and `setup().start()` still succeeds — so it is recorded explicitly to stop a future reviewer from re-attempting it. Findings 2 and 3 are disputed and no code changed. The "hardcoded key" is Microsoft's published Azurite well-known emulator key against 127.0.0.1, so there is no secret to rotate. The "unvalidated recipient" reaches normalizePreparedMail only from the host-owned preparation port, which is the trusted side of the boundary SECURITY.md defines; CRLF and header injection are already blocked, and hard-coding an address grammar would violate this package's provider-neutral mandate. Also restores `npm run format:check`, which main was failing on docs/securityscan.md, and adds the 0.1.1 release notes RELEASING.md requires. `npm audit` drops from 12 advisories (5 high, 7 moderate) to 9 (5 high, 4 moderate); `npm audit --omit=dev` stays at 0 and no public API changes. Co-Authored-By: Claude Fable 5 --- docs/RELEASE_NOTES.md | 20 +++++++++ docs/securityscan.md | 82 +++++++++++++++++++++++++++++----- package-lock.json | 15 ++++--- package.json | 3 ++ packages/mail/package.json | 2 +- tests/release-packages.test.ts | 25 +++++++++++ 6 files changed, 130 insertions(+), 17 deletions(-) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 372c14d..3f2c5ba 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -1,5 +1,25 @@ # Release notes +## 0.1.1 — security scan triage + +No public API, runtime dependency, or behavior change: `@pegma/mail@0.1.1` is +byte-equivalent in surface to `0.1.0` and still requires exactly +`@pegma/spine@0.1.1` and `@pegma/storage-core@0.4.0`. + +This release records the 2026-07-29 triage of `docs/securityscan.md`: + +- the `uuid` buffer-bounds advisory (GHSA-w5hq-g745-h8pq) is cleared from the + development tree by a root `overrides` pin to `^11.1.1`, with a lockfile + regression test; and +- the hardcoded-emulator-key and unvalidated-recipient findings were + re-examined and disputed as not valid, so no source changed for either. + +`npm audit --omit=dev` remains 0. The residual `brace-expansion` and +`@opentelemetry/core` advisories are development-only, are documented as +accepted in `docs/securityscan.md` with the verified reason each patched +release is API-incompatible with azurite's pinned tree, and never reach a +published artifact. + ## 0.1.0 — first advertised supported release Status: prepared for reviewed merge, a protected signed annotated `v0.1.0` diff --git a/docs/securityscan.md b/docs/securityscan.md index ae2bf26..714c107 100644 --- a/docs/securityscan.md +++ b/docs/securityscan.md @@ -28,7 +28,7 @@ evidence, exploitability assessment, and file references. enforcement before publish, OIDC-only publish gate. No findings yet. - **[OK] `.github/workflows/*.yml`** — reviewed. All actions pinned by full commit SHA, least-privilege `permissions` (`contents: read`; `id-token: - write` only in the publish job), no `pull_request_target`, no script +write` only in the publish job), no `pull_request_target`, no script injection from event context (release tag used only as a `ref` string and in artifact names, not interpolated into shell), protected-environment gate (`environment: npm-publish`). No findings yet. @@ -62,6 +62,38 @@ evidence, exploitability assessment, and file references. would downgrade azurite (breaking) and is not advisable. Consider `overrides` for `brace-expansion`/`uuid` if a compatible bump exists, or accept with documented justification since exposure is test-only. +- ✅ Resolved 2026-07-29 — pinned `uuid` to `^11.1.1` through a root + `overrides` entry, clearing GHSA-w5hq-g745-h8pq (all three `uuid` advisory + ranges) from the dev tree; the remaining two advisories are accepted with + the verified justification below, because each one's only patched release is + API-incompatible with the tree azurite pins. +- **Override feasibility, verified 2026-07-29:** + - `uuid` — **overridden.** `8.3.2` → `11.1.1`. Both dependents consume named + exports (`require("uuid").v4` in `sequelize`, `v4` in `@azure/ms-rest-js`), + which `uuid@11` still provides; `sequelize`, `@azure/ms-rest-js`, and the + Azurite conformance suite were all exercised against it. + - `brace-expansion` — **not overridable.** `5.0.8` is the sole patched + release, and its CommonJS entry exports + `{ EXPANSION_MAX, EXPANSION_MAX_LENGTH, expand }` rather than a callable + module. `minimatch@3.1.5` does `expand(pattern)` on the bare require, so + the override makes every glob throw + `TypeError: expand is not a function`, breaking `glob@7` → `rimraf@3`. + Reaching a compatible `minimatch` would require overriding `glob` and + `rimraf` too — effectively the azurite downgrade this finding already + rejects. + - `@opentelemetry/core` — **not overridable.** `2.8.0`+ is the sole patched + line, but `applicationinsights@2.9.8` pins `@opentelemetry/sdk-trace-base@1.30.1`, + which reads `TracesSamplerValues.AlwaysOn` — removed in core 2.x. Forcing + core `2.10.0` makes tracer construction throw + `TypeError: Cannot read properties of undefined (reading 'AlwaysOn')`. + Note this failure is latent: `applicationinsights` still loads and + `setup().start()` still succeeds, so the test suite does **not** catch it. +- **Residual risk accepted:** 5 high (`brace-expansion` chain) and 4 moderate + (`@opentelemetry/core` chain) advisories remain, dev-only. + `npm audit --omit=dev` remains **0**, so the release packer's audit gate is + unaffected and the published `@pegma/mail` tarball is unchanged. Both + chains are reachable only from azurite's own fixed-string internals on + 127.0.0.1; revisit when azurite bumps `rimraf` and `applicationinsights`. ### FINDING 2 — Hardcoded storage account key in test file @@ -77,6 +109,16 @@ evidence, exploitability assessment, and file references. package (`tsconfig` excludes `src/**/*.test.ts`; `files` ships only `dist/**`). Flagged so secret scanners don't surprise future reviewers; no action needed beyond awareness. +- ⚠️ Disputed 2026-07-29 — not a valid finding: the string is Microsoft's + published Azurite/Azure Storage Emulator well-known development key, not a + credential. It is documented verbatim in Microsoft's public docs, is + identical in every Azurite installation, and the connection string it sits + in targets `http://127.0.0.1:${TABLE_PORT}` only + (`packages/mail/src/azurite.test.ts:18-26`), so it authenticates to nothing + but a local emulator and grants zero access to any real Azure resource. + Rotation is meaningless (Azurite would reject any other key) and removal + would only obscure it behind indirection. Retained deliberately; there is no + secret to remove and no code change is warranted. - **[OK] `packages/mail/src/azurite.test.ts`** — reviewed (see Finding 2 for the emulator key note). `allowInsecureConnection: true` and `http://` are @@ -88,7 +130,7 @@ evidence, exploitability assessment, and file references. - **[OK] `packages/mail/src/test-support.ts`** — test-only projection helpers; `JSON.parse` on test-owned payloads only; excluded from build. - **[OK] `tests/release-packages.test.ts`** (1,218 lines) — notably contains - *positive* security regression tests: verifies npm tokens + _positive_ security regression tests: verifies npm tokens (`NODE_AUTH_TOKEN`/`NPM_TOKEN`/`NPM_AUTH_TOKEN`) and hostile `npm_config_*` registry overrides do **not** leak into spawned release processes, and that a hostile registry cannot redirect publish traffic. @@ -123,6 +165,20 @@ evidence, exploitability assessment, and file references. recipient/content authorization to the host. If defense-in-depth is desired, a single-address format check could be added here, at the cost of constraining legitimate provider-specific address forms. +- ⚠️ Disputed 2026-07-29 — not a valid finding: `normalizePreparedMail` is + reached only from `await options.preparation.prepare(...)` + (`packages/mail/src/index.ts:1622-1630`), i.e. the host-owned preparation + port. That is the trusted side of the boundary `SECURITY.md:7-10` defines, + so there is no untrusted input path to the value at all — the premise of the + finding is a trust-boundary misread, not a missing check. The injection this + would notionally prevent is already blocked upstream: `CONTROL` rejects + CR/LF in `recipient`, and header names/values are separately constrained + (`/^[A-Za-z0-9-]{1,64}$/`, ≤64 headers, ≤8 KiB, no controls), so no + SMTP-header injection is reachable. Adding an email-format check would also + be actively wrong here: this package is provider-neutral by mandate + (`AGENTS.md`, "no deliverability abstraction"), and hard-coding one address + grammar would reject legitimate provider-specific forms that hosts are + entitled to pass. Deliberately left as-is. ### Deep-logic review notes (no findings) @@ -144,7 +200,7 @@ The following areas were specifically examined and found sound: - **Prototype-pollution / getter resistance:** all untrusted object reads go through own-data-property snapshots; header map keys are charset-restricted (so `__proto__` is unreachable); frozen outputs. (`index.ts:482-542, - 984-1017`) +984-1017`) - **Regex safety:** all patterns are bounded/linear (no nested quantifiers); no ReDoS candidates. - **Integer/overflow safety:** exponential backoff exponent capped at 19 and @@ -163,21 +219,27 @@ The following areas were specifically examined and found sound: ## Summary -| # | Finding | Severity | Exploitability | -|---|---------|----------|----------------| -| 1 | Vulnerable transitive dev dependencies via `azurite` (brace-expansion DoS, uuid bounds, OpenTelemetry baggage) | **Low** (dev-only; 0 runtime vulns) | No path through published package; CI/local test emulator only | -| 2 | Hardcoded Azurite development storage key in test | **Informational** | None — Microsoft's public well-known emulator key, local-only | -| 3 | Recipient not format-validated as an email address | **Informational** | Requires compromised host preparation port; injection already blocked | +| # | Finding | Severity | Exploitability | Disposition | +| --- | -------------------------------------------------------------------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------- | +| 1 | Vulnerable transitive dev dependencies via `azurite` (brace-expansion DoS, uuid bounds, OpenTelemetry baggage) | **Low** (dev-only; 0 runtime vulns) | No path through published package; CI/local test emulator only | ✅ Resolved 2026-07-29 (`uuid` pinned; other two chains accepted) | +| 2 | Hardcoded Azurite development storage key in test | **Informational** | None — Microsoft's public well-known emulator key, local-only | ⚠️ Disputed 2026-07-29 | +| 3 | Recipient not format-validated as an email address | **Informational** | Requires compromised host preparation port; injection already blocked | ⚠️ Disputed 2026-07-29 | **Overall assessment:** The repository is in strong security shape. The published package (`@pegma/mail`) has zero known-vulnerable runtime dependencies, a minimal ship list (`dist/**` only), defense-in-depth input validation, fail-closed state transitions, and a heavily hardened, OIDC-only, signed-tag release pipeline with least-privilege, SHA-pinned CI. -The only actionable item is Finding 1 (track upstream `azurite` fixes); -Findings 2 and 3 require no action. +The only actionable item was Finding 1, now partially remediated by the +`uuid` override; Findings 2 and 3 were re-examined and disputed as +not-valid, and no code changed for either. _Scan completed: 2026-07-28. Files reviewed: all tracked source, tests, scripts, workflows, configs, and docs (excluding `node_modules/` and generated `dist/`)._ +_Findings triaged and remediated: 2026-07-29. Every finding above was +independently re-verified against the code and the live dependency tree +before its disposition was recorded; `npm audit` went from 12 advisories +(5 high, 7 moderate) to 9 (5 high, 4 moderate), with +`npm audit --omit=dev` at 0 throughout._ diff --git a/package-lock.json b/package-lock.json index b428ba6..9b1c992 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5339,14 +5339,17 @@ } }, "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.1.tgz", + "integrity": "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==", "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "license": "MIT", "bin": { - "uuid": "dist/bin/uuid" + "uuid": "dist/esm/bin/uuid" } }, "node_modules/validator": { @@ -5715,7 +5718,7 @@ }, "packages/mail": { "name": "@pegma/mail", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@pegma/spine": "0.1.1", diff --git a/package.json b/package.json index 7712570..888c7d7 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,8 @@ "prettier": "^3.9.6", "typescript": "^7.0.2", "vitest": "^4.1.10" + }, + "overrides": { + "uuid": "^11.1.1" } } diff --git a/packages/mail/package.json b/packages/mail/package.json index 47df709..283a8b6 100644 --- a/packages/mail/package.json +++ b/packages/mail/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/mail", - "version": "0.1.0", + "version": "0.1.1", "description": "Durable transactional mail jobs that commit in the caller's own transaction.", "license": "MIT", "type": "module", diff --git a/tests/release-packages.test.ts b/tests/release-packages.test.ts index 7b1c79a..e2ff2be 100644 --- a/tests/release-packages.test.ts +++ b/tests/release-packages.test.ts @@ -376,6 +376,31 @@ describe("release package metadata", () => { }); }); + it("keeps every resolved uuid past the buffer-bounds advisory", () => { + const rootManifest = JSON.parse( + readFileSync(join(process.cwd(), "package.json"), "utf8"), + ) as { overrides: Record }; + expect(rootManifest.overrides).toMatchObject({ uuid: "^11.1.1" }); + + const lockfile = JSON.parse( + readFileSync(join(process.cwd(), "package-lock.json"), "utf8"), + ) as { packages: Record }; + const resolved = Object.entries(lockfile.packages).filter(([path]) => + /(?:^|\/)node_modules\/uuid$/.test(path), + ); + expect(resolved.length).toBeGreaterThan(0); + const vulnerable = resolved.filter(([, entry]) => { + const [major = 0, minor = 0, patch = 0] = (entry.version ?? "0") + .split(".") + .map(Number); + if (major !== 11) return major < 11; + return minor < 1 || (minor === 1 && patch < 1); + }); + expect( + vulnerable.map(([path, entry]) => `${path}@${entry.version}`), + ).toEqual([]); + }); + it("validates package metadata, exact dependencies, and lockfile together", async () => { const releaseTag = process.env.RELEASE_TAG; const releaseCommit = process.env.RELEASE_COMMIT; From ad778ed6cc820cf4fd93a1731cd0a8bd451f9e5c Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 20:37:24 -0400 Subject: [PATCH 2/2] docs: avoid wrapping inline code spans across list continuations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reflow the two `securityscan.md` list items whose inline code spans straddled a line break. Prettier requires the continuation line at column 0 in that shape — it normalizes an indented continuation back to column 0, because indenting would inject the leading spaces into the code span and change the rendered text — so the fix is to reword so the span fits on one line rather than to re-indent. Addresses the Copilot review comment on lines 31 and 203. Co-Authored-By: Claude Fable 5 --- docs/securityscan.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/securityscan.md b/docs/securityscan.md index 714c107..1251719 100644 --- a/docs/securityscan.md +++ b/docs/securityscan.md @@ -27,11 +27,12 @@ evidence, exploitability assessment, and file references. for hash/commit comparisons, signed-tag + origin/main-ancestry + clean-tree enforcement before publish, OIDC-only publish gate. No findings yet. - **[OK] `.github/workflows/*.yml`** — reviewed. All actions pinned by full - commit SHA, least-privilege `permissions` (`contents: read`; `id-token: -write` only in the publish job), no `pull_request_target`, no script - injection from event context (release tag used only as a `ref` string and in - artifact names, not interpolated into shell), protected-environment gate - (`environment: npm-publish`). No findings yet. + commit SHA, least-privilege `permissions` + (`contents: read`, with `id-token: write` only in the publish job), no + `pull_request_target`, no script injection from event context (release tag + used only as a `ref` string and in artifact names, not interpolated into + shell), protected-environment gate (`environment: npm-publish`). No findings + yet. - **[OK] `test/azurite.ts`** — reviewed. Local emulator harness; binds to 127.0.0.1, spawns node with fixed args, no secrets. No findings. @@ -199,8 +200,8 @@ The following areas were specifically examined and found sound: Nothing auto-replays or disappears. (`index.ts:1039-1049, 1471-1477`) - **Prototype-pollution / getter resistance:** all untrusted object reads go through own-data-property snapshots; header map keys are charset-restricted - (so `__proto__` is unreachable); frozen outputs. (`index.ts:482-542, -984-1017`) + (so `__proto__` is unreachable); frozen outputs. + (`index.ts:482-542, 984-1017`) - **Regex safety:** all patterns are bounded/linear (no nested quantifiers); no ReDoS candidates. - **Integer/overflow safety:** exponential backoff exponent capped at 19 and