From a3e95fc98dffa0d73d6c84379ae113c8843069ba Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 20:24:07 -0400 Subject: [PATCH 1/2] Resolve security scan findings and bump to 0.1.1 Anchor the prepared release manifest across the publish job boundary. The manifest previously travelled to the publish job inside the same artifact as the tarballs it describes, so a self-consistent replacement of both would have satisfied every internal check. The prepare job now records the manifest SHA-256 as a job output and the publish job passes it to `release:publish`, which requires the digest and compares it with `timingSafeEqual` before the manifest is parsed. Gate CI on `npm audit --omit=dev` so a future advisory in a shipped dependency fails the build. The remaining advisories are confined to the dev-only Azurite chain, which has no upstream fix: 3.36.0 is the latest release and npm's proposed 3.33.0 is a downgrade that keeps the same vulnerable rimraf and pulls older uuid and @azure/ms-rest-js. Bump all four published packages to 0.1.1 for the release. Co-Authored-By: Claude Fable 5 --- .github/workflows/ci.yml | 6 ++ .github/workflows/publish.yml | 16 +++++- docs/securityscan.md | 55 +++++++++++------- package-lock.json | 14 ++--- packages/storage-azure-blob/package.json | 4 +- packages/storage-blobs/package.json | 2 +- packages/storage-cloudflare-r2/package.json | 4 +- packages/storage-s3/package.json | 4 +- scripts/release-packages.d.mts | 16 +++++- scripts/release-packages.mjs | 56 +++++++++++++++--- tests/release-packages.test.ts | 63 +++++++++++++++++++++ 11 files changed, 195 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3641e03..67490eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,12 @@ jobs: - name: Install dependencies run: npm ci + # Only shipped dependencies gate the build. Advisories confined to the + # dev-only test toolchain (Azurite and its transitives) are tracked in + # docs/securityscan.md rather than blocking every pull request. + - name: Audit runtime dependencies + run: npm audit --omit=dev --audit-level=low + - name: Check formatting run: npm run format:check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3f986b2..3b70fbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,8 @@ concurrency: jobs: prepare: runs-on: ubuntu-latest + outputs: + manifest-digest: ${{ steps.manifest.outputs.digest }} env: RELEASE_TAG: ${{ github.event.release.tag_name }} RELEASE_PRERELEASE: ${{ github.event.release.prerelease }} @@ -71,6 +73,17 @@ jobs: - name: Prepare and verify the release tarball run: npm run release:pack -- -- --require-clean --require-main-ancestor --require-release-tag --expected-release-commit "${RELEASE_COMMIT}" --output .release + # Crosses the job boundary through run metadata rather than the artifact, + # so the publish job cannot be fooled by a self-consistent replacement of + # the manifest and the tarballs it describes. + - name: Record the prepared manifest digest + id: manifest + shell: bash + run: | + digest="$(sha256sum .release/package-manifest.json | cut -d ' ' -f 1)" + printf 'digest=%s\n' "${digest}" >> "${GITHUB_OUTPUT}" + printf 'Prepared manifest SHA-256 %s\n' "${digest}" >> "${GITHUB_STEP_SUMMARY}" + - name: Upload the prepared release id: upload uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 @@ -95,6 +108,7 @@ jobs: env: RELEASE_TAG: ${{ github.event.release.tag_name }} RELEASE_COMMIT: ${{ github.sha }} + RELEASE_MANIFEST_DIGEST: ${{ needs.prepare.outputs.manifest-digest }} steps: - name: Check out the exact release tag @@ -117,4 +131,4 @@ jobs: path: .release - name: Publish the verified prepared tarball - run: npm run release:publish -- -- --expected-release-commit "${RELEASE_COMMIT}" --manifest .release/package-manifest.json + run: npm run release:publish -- -- --expected-release-commit "${RELEASE_COMMIT}" --expected-manifest-digest "${RELEASE_MANIFEST_DIGEST}" --manifest .release/package-manifest.json diff --git a/docs/securityscan.md b/docs/securityscan.md index 1e6bf90..2d028a6 100644 --- a/docs/securityscan.md +++ b/docs/securityscan.md @@ -105,6 +105,13 @@ authorized the caller. Attacker-relevant surfaces: ## Findings ### [MEDIUM] Dev-only dependency chain (azurite) carries 12 known vulnerabilities + +✅ Resolved 2026-07-29 — added a gating `npm audit --omit=dev --audit-level=low` +step to CI so any _runtime_ advisory fails the build; the dev-only azurite chain +has no upstream fix (3.36.0 is the latest release and npm's proposed 3.33.0 is a +downgrade that keeps the same vulnerable `rimraf` and pulls _older_ `uuid` +and `@azure/ms-rest-js`), so it stays a tracked non-gating item. + - **Location:** root `package.json:28` (`"azurite": "^3.36.0"`); full chains in `npm audit` output (appendix below). - **Evidence:** 5 high — `brace-expansion` (GHSA-mh99-v99m-4gvg, DoS via @@ -122,10 +129,17 @@ authorized the caller. Attacker-relevant surfaces: - **Fix:** Track an azurite release that drops the vulnerable transitives and bump the devDependency when available (npm currently proposes azurite 3.33.0 as the "fix", which is a downgrade — verify before applying). Add - `npm audit --omit=dev` (expected clean) to CI so a *runtime* advisory fails + `npm audit --omit=dev` (expected clean) to CI so a _runtime_ advisory fails the build, and keep dev-chain advisories as a tracked, non-gating item. ### [LOW] Publish pipeline trusts the cross-job artifact's self-consistency + +✅ Resolved 2026-07-29 — `prepare` now records the SHA-256 of +`package-manifest.json` as a job output and `publish` passes it to +`release:publish` via `--expected-manifest-digest`, so the manifest is anchored +across the job boundary through run metadata instead of the artifact; the digest +is required and verified with `timingSafeEqual` before the manifest is parsed. + - **Location:** `.github/workflows/publish.yml:74-86, 113-120`; `scripts/release-packages.mjs:509-560` (`verifyPreparedManifest`). - **Evidence:** the `publish` job downloads `.release/` (tarballs plus @@ -154,28 +168,29 @@ authorized the caller. Attacker-relevant surfaces: | Severity | Count | | -------- | ----- | -| Critical | 0 | -| High | 0 | -| Medium | 1 | -| Low | 1 | - -| Layer | Status | -| ----- | ------ | -| Frontend | Not present (library repo) | -| Port (`@pegma/storage-blobs`) | Clean — strict validation, copy-on-store, store-bound cursors | -| Adapters (azure-blob, s3, cloudflare-r2) | Clean — credentials host-injected, no env reads, SAS stripped from cursors | -| Data layer | Not present (no query language; opaque object storage) | -| Config & CI | Strong — pinned actions, least-privilege permissions, OIDC trusted publishing, signed-tag enforcement; one Low on artifact handoff | -| Dependencies | Medium — 12 advisories, all confined to the dev-only azurite chain | +| Critical | 0 | +| High | 0 | +| Medium | 1 | +| Low | 1 | + +| Layer | Status | +| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| Frontend | Not present (library repo) | +| Port (`@pegma/storage-blobs`) | Clean — strict validation, copy-on-store, store-bound cursors | +| Adapters (azure-blob, s3, cloudflare-r2) | Clean — credentials host-injected, no env reads, SAS stripped from cursors | +| Data layer | Not present (no query language; opaque object storage) | +| Config & CI | Strong — pinned actions, least-privilege permissions, OIDC trusted publishing, signed-tag enforcement; artifact handoff Low resolved 2026-07-29 | +| Dependencies | Medium — 12 advisories, all confined to the dev-only azurite chain; runtime audit gate added 2026-07-29, shipped dependencies clean | ### Unverified / Needs Manual Review -- **`.tmp-sc/` working-tree scratch copy of storage-core** — untracked and - git-ignored, so it cannot ship, but confirm it is intentional local scratch - and delete if stale. -- **npm audit "fix" for azurite (3.33.0)** — flagged semver-major and is a - version *downgrade*; needs manual verification against the azurite changelog - before applying. +- **`.tmp-sc/` working-tree scratch copy of storage-core** — ✅ Resolved + 2026-07-29 — confirmed local-only: neither `.tmp-sc/` nor `.grok/` is tracked, + and both are absent from a fresh clone. Nothing to remove in the repository. +- **npm audit "fix" for azurite (3.33.0)** — ✅ Resolved 2026-07-29 — verified + and rejected. 3.33.0 declares the same vulnerable `rimraf ^3.0.2` plus older + `uuid ^3.3.2` and `@azure/ms-rest-js ^1.5.0`, so the "fix" is a downgrade that + resolves nothing. The devDependency stays at `^3.36.0`. ### Appendix — npm audit (raw, trimmed) diff --git a/package-lock.json b/package-lock.json index 2af67be..c78627c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6249,11 +6249,11 @@ }, "packages/storage-azure-blob": { "name": "@pegma/storage-azure-blob", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@azure/storage-blob": "^12.29.1", - "@pegma/storage-blobs": "0.1.0" + "@pegma/storage-blobs": "0.1.1" }, "engines": { "node": ">=22" @@ -6261,7 +6261,7 @@ }, "packages/storage-blobs": { "name": "@pegma/storage-blobs", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "engines": { "node": ">=22" @@ -6269,11 +6269,11 @@ }, "packages/storage-cloudflare-r2": { "name": "@pegma/storage-cloudflare-r2", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.1097.0", - "@pegma/storage-blobs": "0.1.0" + "@pegma/storage-blobs": "0.1.1" }, "engines": { "node": ">=22" @@ -6281,11 +6281,11 @@ }, "packages/storage-s3": { "name": "@pegma/storage-s3", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.1097.0", - "@pegma/storage-blobs": "0.1.0" + "@pegma/storage-blobs": "0.1.1" }, "engines": { "node": ">=22" diff --git a/packages/storage-azure-blob/package.json b/packages/storage-azure-blob/package.json index 0599bb4..74e2843 100644 --- a/packages/storage-azure-blob/package.json +++ b/packages/storage-azure-blob/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/storage-azure-blob", - "version": "0.1.0", + "version": "0.1.1", "description": "Azure Blob Storage adapter for @pegma/storage-blobs.", "license": "MIT", "type": "module", @@ -30,7 +30,7 @@ }, "dependencies": { "@azure/storage-blob": "^12.29.1", - "@pegma/storage-blobs": "0.1.0" + "@pegma/storage-blobs": "0.1.1" }, "scripts": { "build": "tsc -p tsconfig.json", diff --git a/packages/storage-blobs/package.json b/packages/storage-blobs/package.json index a9a655d..682550c 100644 --- a/packages/storage-blobs/package.json +++ b/packages/storage-blobs/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/storage-blobs", - "version": "0.1.0", + "version": "0.1.1", "description": "Provider-neutral object (blob) storage: opaque keys, streaming put/get, conditionals, and a conformance suite.", "license": "MIT", "type": "module", diff --git a/packages/storage-cloudflare-r2/package.json b/packages/storage-cloudflare-r2/package.json index 8b90f10..bd9588b 100644 --- a/packages/storage-cloudflare-r2/package.json +++ b/packages/storage-cloudflare-r2/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/storage-cloudflare-r2", - "version": "0.1.0", + "version": "0.1.1", "description": "Cloudflare R2 adapter for @pegma/storage-blobs (S3-compatible API).", "license": "MIT", "type": "module", @@ -30,7 +30,7 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.1097.0", - "@pegma/storage-blobs": "0.1.0" + "@pegma/storage-blobs": "0.1.1" }, "scripts": { "build": "tsc -p tsconfig.json", diff --git a/packages/storage-s3/package.json b/packages/storage-s3/package.json index b8dc63d..0d5415f 100644 --- a/packages/storage-s3/package.json +++ b/packages/storage-s3/package.json @@ -1,6 +1,6 @@ { "name": "@pegma/storage-s3", - "version": "0.1.0", + "version": "0.1.1", "description": "AWS S3 / S3-compatible adapter for @pegma/storage-blobs.", "license": "MIT", "type": "module", @@ -30,7 +30,7 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.1097.0", - "@pegma/storage-blobs": "0.1.0" + "@pegma/storage-blobs": "0.1.1" }, "scripts": { "build": "tsc -p tsconfig.json", diff --git a/scripts/release-packages.d.mts b/scripts/release-packages.d.mts index 309a4ac..04eb939 100644 --- a/scripts/release-packages.d.mts +++ b/scripts/release-packages.d.mts @@ -16,6 +16,7 @@ export interface ValidationOptions { export interface ReleaseCommandOptions extends ValidationOptions { readonly manifest?: string; readonly output?: string; + readonly expectedManifestDigest?: string; } export interface PublicPackageManifest { @@ -52,9 +53,18 @@ export function decidePublication( registryIntegrity: string | null, ): "publish" | "skip"; -export function prepareRelease( - options?: ReleaseCommandOptions, -): Promise<{ manifestPath: string; manifest: unknown }>; +export function digestManifest(bytes: Uint8Array | string): string; + +export function verifyManifestDigest( + bytes: Uint8Array | string, + expectedDigest: string | undefined, +): string; + +export function prepareRelease(options?: ReleaseCommandOptions): Promise<{ + manifestPath: string; + manifest: unknown; + manifestDigest: string; +}>; export function publishPreparedRelease( options?: ReleaseCommandOptions, diff --git a/scripts/release-packages.mjs b/scripts/release-packages.mjs index e6e9804..905fd6d 100644 --- a/scripts/release-packages.mjs +++ b/scripts/release-packages.mjs @@ -92,6 +92,32 @@ function hashTarball(bytes) { }; } +export function digestManifest(bytes) { + return createHash("sha256").update(bytes).digest("hex"); +} + +// The prepared manifest travels to the publish job inside the same artifact as +// the tarballs it describes, so a self-consistent replacement of both would +// satisfy every internal check. The preparation job therefore reports the +// manifest digest as a job output, which crosses the boundary through run +// metadata instead of the artifact, and publication refuses to proceed without +// a match. +export function verifyManifestDigest(bytes, expectedDigest) { + if (expectedDigest === undefined || expectedDigest === "") { + fail("an expected prepared manifest digest is required"); + } + if (!/^[0-9a-f]{64}$/u.test(expectedDigest)) { + fail("the expected prepared manifest digest must be SHA-256 hexadecimal"); + } + const actualDigest = digestManifest(bytes); + if (!safeEqual(actualDigest, expectedDigest)) { + fail( + "the prepared package manifest does not match the digest recorded by the preparation job", + ); + } + return actualDigest; +} + function exportTargets(value) { if (typeof value === "string") return [value]; if (value !== null && typeof value === "object" && !Array.isArray(value)) { @@ -449,8 +475,16 @@ export async function prepareRelease(options = {}) { packages: preparedPackages, }; const manifestPath = join(output, "package-manifest.json"); - await writeFile(manifestPath, `${JSON.stringify(prepared, null, 2)}\n`); - return { manifestPath, manifest: prepared }; + const manifestBytes = Buffer.from( + `${JSON.stringify(prepared, null, 2)}\n`, + "utf8", + ); + await writeFile(manifestPath, manifestBytes); + return { + manifestPath, + manifest: prepared, + manifestDigest: digestManifest(manifestBytes), + }; } function queryRegistryIntegrity(name, version) { @@ -506,8 +540,10 @@ function confirmRegistryIntegrity(record) { ); } -async function verifyPreparedManifest(path) { - const prepared = await readJson(path); +async function verifyPreparedManifest(path, expectedManifestDigest) { + const manifestBytes = await readFile(path); + verifyManifestDigest(manifestBytes, expectedManifestDigest); + const prepared = JSON.parse(manifestBytes.toString("utf8")); const records = prepared.packages; if ( prepared.schemaVersion !== 2 || @@ -568,7 +604,10 @@ export async function publishPreparedRelease(options = {}) { } requireTrustedPublishingNpm(); const path = resolve(options.manifest ?? ".release/package-manifest.json"); - const prepared = await verifyPreparedManifest(path); + const prepared = await verifyPreparedManifest( + path, + options.expectedManifestDigest ?? process.env.RELEASE_MANIFEST_DIGEST, + ); const releaseTag = options.releaseTag ?? process.env.RELEASE_TAG; const expectedCommit = options.expectedReleaseCommit ?? process.env.RELEASE_COMMIT; @@ -634,7 +673,9 @@ export function parseArguments(arguments_) { ? "manifest" : argument === "--expected-release-commit" ? "expectedReleaseCommit" - : null; + : argument === "--expected-manifest-digest" + ? "expectedManifestDigest" + : null; if (key === null || arguments_[index + 1] === undefined) { fail(`unknown or incomplete argument: ${argument}`); } @@ -657,8 +698,9 @@ async function main() { return; } if (command === "pack") { - const { manifestPath } = await prepareRelease(options); + const { manifestPath, manifestDigest } = await prepareRelease(options); process.stdout.write(`Prepared release package at ${manifestPath}.\n`); + process.stdout.write(`Prepared manifest SHA-256 ${manifestDigest}.\n`); return; } if (command === "publish") { diff --git a/tests/release-packages.test.ts b/tests/release-packages.test.ts index 5656b05..97fec17 100644 --- a/tests/release-packages.test.ts +++ b/tests/release-packages.test.ts @@ -6,9 +6,11 @@ import { describe, expect, it } from "vitest"; import { RELEASE_PACKAGES, decidePublication, + digestManifest, parseArguments, validateReleaseTag, validateRepository, + verifyManifestDigest, } from "../scripts/release-packages.mjs"; const git = process.platform === "win32" ? "git.exe" : "git"; @@ -36,6 +38,15 @@ describe("release package metadata", () => { }); }); + it("parses the expected prepared manifest digest", () => { + expect( + parseArguments(["--expected-manifest-digest", "a".repeat(64)]), + ).toEqual({ expectedManifestDigest: "a".repeat(64) }); + expect(() => parseArguments(["--expected-manifest-digest"])).toThrow( + "unknown or incomplete argument", + ); + }); + it("keeps the exact public package inventory", () => { expect(RELEASE_PACKAGES.map(({ name }) => name)).toEqual([ "@pegma/storage-blobs", @@ -167,6 +178,58 @@ describe("release source authentication", () => { }); }); +describe("prepared manifest anchoring", () => { + const manifestBytes = '{"schemaVersion":2}\n'; + const digest = digestManifest(manifestBytes); + + it("accepts the digest recorded by the preparation job", () => { + expect(digest).toMatch(/^[0-9a-f]{64}$/u); + expect(verifyManifestDigest(manifestBytes, digest)).toBe(digest); + expect(verifyManifestDigest(Buffer.from(manifestBytes), digest)).toBe( + digest, + ); + }); + + it("rejects a manifest replaced alongside its tarballs", () => { + expect(() => + verifyManifestDigest('{"schemaVersion":2} \n', digest), + ).toThrow("does not match the digest recorded by the preparation job"); + }); + + it("refuses to publish without a usable expected digest", () => { + expect(() => verifyManifestDigest(manifestBytes, undefined)).toThrow( + "an expected prepared manifest digest is required", + ); + expect(() => verifyManifestDigest(manifestBytes, "")).toThrow( + "an expected prepared manifest digest is required", + ); + expect(() => verifyManifestDigest(manifestBytes, "not-a-digest")).toThrow( + "must be SHA-256 hexadecimal", + ); + expect(() => + verifyManifestDigest(manifestBytes, digest.toUpperCase()), + ).toThrow("must be SHA-256 hexadecimal"); + }); + + it("carries the digest across the job boundary in run metadata", () => { + const workflow = readFileSync( + join(process.cwd(), ".github", "workflows", "publish.yml"), + "utf8", + ); + const jobs = workflow.slice(workflow.indexOf("\njobs:\n")); + const publishStart = jobs.indexOf("\n publish:"); + const prepare = jobs.slice(jobs.indexOf(" prepare:"), publishStart); + const publish = jobs.slice(publishStart); + expect(prepare).toContain( + "manifest-digest: ${{ steps.manifest.outputs.digest }}", + ); + expect(publish).toContain( + "RELEASE_MANIFEST_DIGEST: ${{ needs.prepare.outputs.manifest-digest }}", + ); + expect(publish).toContain("--expected-manifest-digest"); + }); +}); + describe("retry-safe publication", () => { const integrity = "sha512-cHJlcGFyZWQtdGFyYmFsbA=="; From 8dc956a89557d24f332bafa7fa994c529826ac88 Mon Sep 17 00:00:00 2001 From: Nathan Rover Date: Wed, 29 Jul 2026 20:33:09 -0400 Subject: [PATCH 2/2] Address review feedback on the security scan fixes Assert the workflow section boundaries before slicing in the manifest-anchoring test, matching the existing publish-workflow test so a layout change fails with an actionable message instead of a confusing slice. Reword the azurite finding as contained rather than eliminated: the advisories are still open upstream and only the runtime boundary changed. Mark the summary counts as the original scan record and add the current state per severity. Co-Authored-By: Claude Fable 5 --- docs/securityscan.md | 32 +++++++++++++++++++++----------- tests/release-packages.test.ts | 10 ++++++++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/docs/securityscan.md b/docs/securityscan.md index 2d028a6..f25c7e3 100644 --- a/docs/securityscan.md +++ b/docs/securityscan.md @@ -106,11 +106,15 @@ authorized the caller. Attacker-relevant surfaces: ### [MEDIUM] Dev-only dependency chain (azurite) carries 12 known vulnerabilities -✅ Resolved 2026-07-29 — added a gating `npm audit --omit=dev --audit-level=low` -step to CI so any _runtime_ advisory fails the build; the dev-only azurite chain -has no upstream fix (3.36.0 is the latest release and npm's proposed 3.33.0 is a -downgrade that keeps the same vulnerable `rimraf` and pulls _older_ `uuid` -and `@azure/ms-rest-js`), so it stays a tracked non-gating item. +✅ Resolved 2026-07-29 — resolved as **contained, not eliminated**. The 12 +advisories are still present in the dev-only azurite chain and there is no +upstream fix to take: 3.36.0 is the latest release, and npm's proposed 3.33.0 is +a downgrade that keeps the same vulnerable `rimraf` and pulls _older_ `uuid` and +`@azure/ms-rest-js`. What changed is the boundary: CI now gates on +`npm audit --omit=dev --audit-level=low`, so shipped dependencies are enforced +clean (currently 0 advisories) and any future _runtime_ advisory fails the build, +while the dev-chain advisories remain a tracked, non-gating item to re-check when +azurite next releases. - **Location:** root `package.json:28` (`"azurite": "^3.36.0"`); full chains in `npm audit` output (appendix below). @@ -166,12 +170,18 @@ is required and verified with `timingSafeEqual` before the manifest is parsed. ## Phase 3 — Summary -| Severity | Count | -| -------- | ----- | -| Critical | 0 | -| High | 0 | -| Medium | 1 | -| Low | 1 | +Counts below are **as originally scanned on 2026-07-29**, kept as the scan +record. Both findings were subsequently dispositioned — see the per-finding +resolution notes above: the Low (artifact handoff) is fixed outright, and the +Medium (azurite dev chain) is contained by the runtime audit gate with the +dev-only advisories still open upstream. + +| Severity | Count | Current state | +| -------- | ----- | ------------------------------------- | +| Critical | 0 | — | +| High | 0 | — | +| Medium | 1 | Contained (dev-only, no upstream fix) | +| Low | 1 | Fixed | | Layer | Status | | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/tests/release-packages.test.ts b/tests/release-packages.test.ts index 97fec17..10670a5 100644 --- a/tests/release-packages.test.ts +++ b/tests/release-packages.test.ts @@ -216,9 +216,15 @@ describe("prepared manifest anchoring", () => { join(process.cwd(), ".github", "workflows", "publish.yml"), "utf8", ); - const jobs = workflow.slice(workflow.indexOf("\njobs:\n")); + const jobsMarker = "\njobs:\n"; + const jobsIndex = workflow.indexOf(jobsMarker); + expect(jobsIndex).toBeGreaterThanOrEqual(0); + const jobs = workflow.slice(jobsIndex + jobsMarker.length); + const prepareStart = jobs.indexOf(" prepare:"); const publishStart = jobs.indexOf("\n publish:"); - const prepare = jobs.slice(jobs.indexOf(" prepare:"), publishStart); + expect(prepareStart).toBeGreaterThanOrEqual(0); + expect(publishStart).toBeGreaterThan(prepareStart); + const prepare = jobs.slice(prepareStart, publishStart); const publish = jobs.slice(publishStart); expect(prepare).toContain( "manifest-digest: ${{ steps.manifest.outputs.digest }}",