Skip to content

Add SECURITY.md and packed provenance - #9

Draft
nedtwigg wants to merge 2 commits into
peer-dependenciesfrom
security-spec
Draft

nedtwigg wants to merge 2 commits into
peer-dependenciesfrom
security-spec

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Stacked on #8 (peer-dependencies). First of two PRs giving pgstencil its own security validation, so consumers can stop auditing the packed tarballs and verify the link instead.

What

  • SECURITY.md — the packages' security guarantees as auditable FAIL IF rules (11 sections, 29 rules), each pinned to the integration or unit test that proves it. Every rule was checked against packages/auth/src and packages/pgstencil/src before being written; claims the code does not make (e.g. the Facebook token-app validation, which happens upstream in Better Auth) went under "What is not defended" instead. The legacy Auth/createAuthHttp/native OAuth exports and @pgstencil/stripe are declared out of scope for now.
  • Packed provenancepackages:pack now refuses to build from a modified input tree (packages, scripts, tsconfigs, lockfile, compose.yaml, LICENSE, package.json) unless --allow-dirty, and every tarball carries package/dist/provenance.json = {"commit": "<sha>"} (plus "dirty": true only for an allowed-dirty pack). packages:verify fails when an installed package's provenance is not this checkout's HEAD. PACKAGES.md documents the contract path (tar -xOf <tgz> package/dist/provenance.json).
  • packages:pack moved from a compound shell script to scripts/pack-packages.ts, because pnpm appends -- arguments to the last command of a compound script, so --allow-dirty could never reach the build.

Verified

pnpm format:check, typecheck, db:verify, test:unit, full pnpm test (160 tests, Docker), packages:verify (installed provenance = HEAD), plus the dirty refusal and --allow-dirty paths by hand. Ran on Node 26 locally; CI is the Node 24 run.

Next

PR 2 adds the nightly security-audit workflow that executes SECURITY.md; dormouse#742's follow-up verifies the vendored commit's check run.

🤖 Generated with Claude Code

nedtwigg and others added 2 commits September 21, 2026 17:11
A packed tarball carried nothing identifying the source it was built
from, so a consumer vendoring the archives could not prove which commit
it runs. Every archive now ships dist/provenance.json with the packing
commit, and packing refuses a modified build input tree unless
--allow-dirty marks the result.

packages:pack runs the build in the same Node process as pnpm pack so
the flag reaches the build's argv; pnpm appends script arguments to the
end of a compound shell command, where they would land on pnpm pack.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The security policy lived as prose in examples/better-auth/README.md and
PACKAGES.md, phrased for a reader rather than a checker. State it once at
the repo root as FAIL IF conditions, each naming what to inspect, and end
each section with the tests that pin it, so a consumer's nightly audit
can execute this file instead of reading the compiled tarballs.

The prose stays where it is; it explains the same choices to a human.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant