Repository navigation
chore: harden pnpm supply-chain config - #1068
Conversation
Pin pnpm (packageManager: [email protected]) so the build-script/trust schema is deterministic, and add supply-chain hardening to pnpm-workspace.yaml: - minimumReleaseAge 1440 (24h publish cooldown); @rolldown/* and @emnapi/* excluded (vite8/rolldown-rc exact-pins these per-arch binaries; their release cadence structurally conflicts with the cooldown and they are not an attack surface worth the friction) - strictDepBuilds + explicit allowBuilds: build scripts run only for @parcel/watcher, sharp, better-sqlite3, esbuild, workerd; core-js-pure denied (donation postinstall, not needed) - dangerouslyAllowAllBuilds false - blockExoticSubdeps true, with an @astrojs/telemetry -> 3.3.0 override (infra/cache-demo's pkg.pr.new Astro cache-support preview pulls telemetry via URL; the override keeps the guard on) - trustPolicy no-downgrade with a reviewed, version-pinned trustPolicyExclude ([email protected], [email protected], [email protected], @portabletext/[email protected], [email protected] -- all benign publish-method changes / old pre-provenance pins, not takeovers) - verifyStoreIntegrity, strictStorePkgContentCheck, verifyDepsBeforeRun error Move enable-pre-post-scripts from .npmrc to pnpm-workspace.yaml (enablePrePostScripts: true; canonical location, also silences the npm "unknown config" warning). Remove .npmrc entirely -- provenance is implied by OIDC trusted publishing. Lockfile regenerated under the hardened config with pnpm 11.1.2.
|
PR template validation failedPlease fix the following issues by editing your PR description:
See CONTRIBUTING.md for the full contribution policy. |
Scope checkThis PR changes 677 lines across 4 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-perf-coordinator | 6ef112d | May 18 2026, 10:20 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-i18n | 6ef112d | May 18 2026, 10:20 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 6ef112d | May 18 2026, 10:21 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 6ef112d | May 18 2026, 10:21 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 6ef112d | May 18 2026, 10:21 AM |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
Pull request overview
This PR hardens the monorepo’s pnpm supply-chain configuration by pinning pnpm, enabling stricter install/build safeguards, and regenerating the lockfile under the new policy.
Changes:
- Pins the workspace package manager to
[email protected]. - Adds pnpm workspace hardening settings for release-age gating, build-script allowlisting, trust policy checks, and exotic subdependency blocking.
- Regenerates the lockfile with the new override and pnpm metadata changes.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
pnpm-workspace.yaml |
Adds pnpm supply-chain hardening settings, build/trust policy config, telemetry override, and broadens infra workspace matching. |
pnpm-lock.yaml |
Regenerated lockfile reflecting pnpm 11 resolution, telemetry override, metadata changes, and dependency snapshot updates. |
package.json |
Updates packageManager from pnpm 10 to pnpm 11. |
.npmrc |
Removes previous pnpm/npm config now intended to live elsewhere or be implied by publishing setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -2387,7 +2390,7 @@ packages: | |||
| wrangler: ^4.61.1 | |||
|
|
|||
| '@astrojs/cloudflare@https://pkg.pr.new/@astrojs/cloudflare@94d342d': | |||
| resolution: {integrity: sha512-Bt+G512Dr1SqYdsza6HOLP2azfHg0m5UE0s6SBGX77g+ThFV95Nai5boyM8HO3jVpqwVPPh+5ycMptjrtzv7Yg==, tarball: https://pkg.pr.new/@astrojs/cloudflare@94d342d} | |||
| resolution: {tarball: https://pkg.pr.new/@astrojs/cloudflare@94d342d} | |||
| "typescript": "6.0.0-beta" | ||
| }, | ||
| "packageManager": "pnpm@10.28.0", | ||
| "packageManager": "pnpm@11.1.2", |
| - "@rolldown/*" | ||
| - "@emnapi/*" |
| @@ -1,3 +1,37 @@ | |||
| # Supply-chain hardening. allowBuilds/trustPolicyExclude policy: CONTRIBUTING.md | |||
| '@ungap/[email protected]': | ||
| resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==} | ||
| deprecated: Potential CWE-502 - Update to 1.3.1 or higher |
- Remove stale root pnpm.onlyBuiltDependencies (dead under pinned pnpm 11; allowBuilds in pnpm-workspace.yaml is the single source) - Narrow cooldown excludes: @rolldown/* -> @rolldown/binding-*, and @emnapi/* -> @emnapi/core/@emnapi/runtime, so the cooldown stays active for JS like @rolldown/pluginutils / @emnapi/wasi-threads - Drop the dangling CONTRIBUTING.md pointer (no such policy doc) - Override @ungap/structured-clone to ^1.3.1 (1.3.0 deprecated, CWE-502) - Regenerate the lockfile from a clean store so the astro pkg.pr.new tarball regains its SRI integrity (the earlier warm-store regen dropped it; @astrojs/cloudflare and @lunariajs/core never had SRI, pre-PR included -- pnpm doesn't record it for those URLs) Re-resolved clean under pnpm 11.1.2 with the narrowed excludes.
|
Thanks — addressed all five in
|
|
/bonk resolve the conflicts |
Resolves lockfile conflict by regenerating under pnpm 11.1.2 with the merged hardened config + main's TypeScript 6 catalog. Frozen install verified clean.
|
Merge commit looks clean. The branch now has main merged in, with the lockfile cleanly regenerated under the hardened config. Resolved the conflict with Resolution:
Merge commit pushed as |
|
All contributors have signed the CLA ✍️ ✅ |
* fix: resolve #1053 type errors for strict consumers Closes #1053. Two parts: 1. wordpress-plugin.ts: the analyze-endpoint error body from response.json() is unknown under @cloudflare/workers-types; narrow it before reading .message (was the reported TS18046). The other reported error (byline.ts kysely Transaction variance) was TS5.x behaviour, resolved by the TS6 upgrade in #1074. 2. Stop shipping raw .ts for the source-exported subpaths (emdash/routes/*, emdash/api/route-utils, emdash/api/schemas, emdash/auth/providers/*). They are compiled to dist (.mjs + .d.mts), so a strict consumer's tsc only ever sees declarations (skipLibCheck covers them), eliminating the dual-package Database identity wall that is #1053's root cause. ./ui and .astro stay source (the consumer's Astro build must process them). - tsdown: route entrypoints fed via inputOptions.input (literal object, not entry globs -- [param] dirs are glob char-classes). entryFileNames + resolveRoute share one routeArtifactName() so rolldown's reserved [name]/[hash] placeholders cannot mangle dynamic-route artifacts. - A fast static guard (scripts/typecheck-public-source.mjs, wired into CI) fails if any subpath export ships raw .ts/.tsx again. Verified: pnpm build, pnpm typecheck, demos+templates typecheck, demo build (route injection e2e), lint baseline unchanged. * style: format * fix(build): externalize self/optional deps so route entries don't bundle them Compiling the route/admin entries made tsdown try to bundle deps it could not resolve at build time -- 'emdash' (the package importing itself) and '@cloudflare/kumo' (admin-only, not an emdash dep). CI escalates tsdown's bundling advisory to a fatal error. - Externalize 'emdash' (self): compiled routes import it; resolved at the consumer's runtime where the package is installed. - Externalize @aws-sdk/* (optional S3 deps, runtime-only). - Keep the *-admin.tsx providers as source (bridge the admin React + @cloudflare/kumo runtime, like .astro/./ui); revert their exports. - inlineOnly: false -- nothing is unintentionally bundled (all deps external, only our own src is); silences the CI-escalated advisory. Guard's allowlist generalized to RUNTIME_COUPLED (Astro + admin React). * test: route-injection entrypoint now resolves to compiled artifact resolveRoute resolves emdash/routes/* to the compiled dist artifact with routeArtifactName applied ([ ] -> _), so the media catch-all route's entrypoint is api/media/file/_...key_ not [...key].ts. The catch-all pattern assertion (the actual guarantee) is unchanged. --------- Co-authored-by: emdashbot[bot] <emdashbot[bot]@users.noreply.github.com>
3db236c to
6ef112d
Compare
What does this PR do?
Hardens the monorepo's pnpm config against supply-chain attacks (motivated by the recent major npm worm/compromised-publish incidents). This is our own repo, so it runs tight and absorbs the maintenance.
Pin pnpm (
packageManager: "[email protected]") so the build-script/trust schema is deterministic (pnpm 10 vs 11 differ materially:allowBuildsvsonlyBuiltDependencies)..npmrcremoved (enable-pre-post-scriptsmoved topnpm-workspace.yamlasenablePrePostScripts: true— canonical location, also silences the npm "unknown config" warning;provenanceis implied by OIDC trusted publishing).pnpm-workspace.yamlhardening:minimumReleaseAge: 1440— 24h publish cooldown (core defense vs fresh malicious publishes).@rolldown/*/@emnapi/*excluded: vite8/rolldown-rc exact-pins these per-arch binaries on a release cadence that structurally conflicts with the cooldown.strictDepBuilds: true+ explicitallowBuilds— build scripts run only for@parcel/watcher,sharp,better-sqlite3,esbuild,workerd;core-js-pure: false(donation postinstall, unneeded).dangerouslyAllowAllBuilds: false.blockExoticSubdeps: true+ an@astrojs/telemetry→3.3.0override (infra/cache-demopins the pkg.pr.new Astro cache-support preview, which pulls telemetry via URL; override keeps the guard on without dropping the load-bearing preview).trustPolicy: no-downgrade+ a reviewed, version-pinnedtrustPolicyExclude:[email protected],[email protected],[email protected],@portabletext/[email protected],[email protected]— each a benign publish-method change or old pre-provenance pin in a deep transitive chain, individually reviewed (not takeovers). The guard stays active for everything else.verifyStoreIntegrity,strictStorePkgContentCheck,verifyDepsBeforeRun: error.Lockfile regenerated under the hardened config with pnpm 11.1.2 (bounded delta — mostly the telemetry override + minor cooldown nudges).
No related issue.
Type of change
Checklist
pnpm typecheckpasses — not run locally (no source changed; deps/config only; CI covers it)pnpm lintpasses — not run locally; CI covers itpnpm testpasses — verification is the full hardenedpnpm installresolving + building clean under pinned [email protected] (resolution,strictDepBuilds,blockExoticSubdeps,trustPolicy, integrity,verifyDepsBeforeRunall pass)pnpm formathas been run — N/A: no formatted source changedAI-generated code disclosure
Screenshots / test output
npx [email protected] install --no-frozen-lockfile→Done in 36.4s, exit 0, no trust/exotic/cooldown/build-script errors; lockfile delta+378/-299.Notes
trustPolicyExcludeis a maintained list: a new entry is needed when a dependency legitimately changes publish method (industry trend is provenance → trusted-OIDC, an upgradeno-downgradeignores, so growth should be slow). Each entry is version-pinned and self-expires on the next bump.