fix(ci): tie Vercel CLI policy gates to what they protect, not a hand-edited pin - #304
amanthanvi wants to merge 4 commits into
Conversation
Replace the pinned Vercel CLI 58.4.4 / sandbox@3.4.0 tripwire with the condition that justifies the exceptions: every sandbox in the lockfile is a stable release at or above 1.0.0 (outside both advisories' affected range), reached only through the root Vercel CLI dependency. Stale exceptions fail once sandbox disappears, and expiry must now fall between 30 days and one year out so exceptions still get periodic review. Add regression tests and run them in ops:test. Co-authored-by: Aman Thanvi <amanthanvi@users.noreply.github.com>
…fest The production guard compared vercel --version with a literal that had to match package.json. Compare it with the trusted tooling package.json that deps:provenance verifies earlier in the same job instead, so the deployed binary is still exactly the attested pin without a second copy to edit. Co-authored-by: Aman Thanvi <amanthanvi@users.noreply.github.com>
Co-authored-by: Aman Thanvi <amanthanvi@users.noreply.github.com>
Co-authored-by: Aman Thanvi <amanthanvi@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideThis PR removes brittle Vercel CLI and sandbox version pins from CI policy checks while preserving the SLSA provenance gate: OSV exceptions are now validated against package identity, dependency reachability, stable version range, and bounded review expiry, and deployment compares the installed CLI with the trusted manifest verified earlier in the job. Tests, runbooks, error guidance, and changelog entries document and enforce the new contracts. Sequence diagram for trusted Vercel CLI deployment validationsequenceDiagram
participant CI
participant Provenance as deps:provenance
participant Manifest as tooling/package.json
participant CLI as Vercel CLI
participant Deploy as deploy-vercel.sh
CI->>Provenance: check-vercel-provenance.mjs
Provenance->>Manifest: verify devDependencies.vercel
Provenance-->>CI: provenance verified
CI->>Manifest: read devDependencies.vercel
Manifest-->>CI: trusted_vercel
CI->>CLI: vercel --version
CLI-->>CI: installed version
alt versions match
CI->>Deploy: run scripts/deploy-vercel.sh
else versions differ
CI-->>CI: exit 1
end
Flow diagram for OSV exception contract validationflowchart TD
A[Read osv-scanner exceptions] --> B[Read lockfile dependency tree]
B --> C{Exactly two allowed advisory IDs?}
C -- No --> F[Fail CI]
C -- Yes --> D{Exceptions expire 30 days to one year out?}
D -- No --> F
D -- Yes --> E{Every sandbox is stable >= 1.0.0 and reachable only via root vercel?}
E -- No --> F
E -- Yes --> G{sandbox still exists?}
G -- No --> F
G -- Yes --> H[OSV exception contract passes]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
What
These are the version-independent policy fixes from #299 (the vercel 58.4.4 → 62.2.0 Dependabot bump), split out so they can land on main while the CLI stays on attested 58.4.4. #299 itself stays blocked by the SLSA provenance gate, and Dependabot will probably close it when it opens a 63.x PR.
scripts/check-osv-exceptions.mjs: the old check failed unlesspackage.jsonpinnedvercel58.4.4and the lockfile hadsandbox@3.4.0. It now checks the condition that actually justifies the twosandboxexceptions:sandboxin the lockfile is a stable release ≥1.0.0, which is outside both advisories' GitHub-bounded<1.0.0range (legacygf3/sandboxis 0.x; Vercel took over the name at 1.0.0);sandboxis only reachable through the rootverceldevDependency;sandboxdisappears (the exception is stale) or if any other exception ID is added;node:testregression tests inscripts/check-osv-exceptions.test.mjs, added toops:test.deploy.yml: the production guard comparedvercel --versionwith a literal"58.4.4". It now compares againstdevDependencies.vercelin the trusted toolingpackage.json. That's the same manifestpnpm deps:provenanceverifies earlier in the same job, before any secret is exposed. The contract test asserts this.scripts/check-vercel-provenance.mjs: the verification logic is unchanged. Only the error message now points todocs/runbooks/vercel-ops.md#cli-provenance.Why
Two different things blocked #299:
vercel/vercel-internalrepo (vercel/vercel#17408), and npm doesn't generate provenance for private-repo publishes. I checked 58.5.1 through 63.1.2: everyregistry.npmjs.org/-/npm/v1/attestations/vercel@<v>returns 404. The provenance gate is correct and stays as is.deploy.ymlhard-coded58.4.4/sandbox@3.4.0. They would block even a correctly attested bump until someone edited code. CI never even reached thedeploy.ymlone (ops:test) because the OSV step failed first.This PR removes only the second kind. The security properties are unchanged or stronger:
vercel/vercelrelease.yml@refs/heads/mainworkflow, and the subject digest.The same commits pass unchanged on main (vercel 58.4.4 /
sandbox@3.4.0) and on #299 (62.2.0 /sandbox@4.4.0). Once an attested release exists, a Dependabot bump will need no manual edits.Checklist
pnpm next:lint,pnpm next:grammar,pnpm next:test,pnpm convex:test,pnpm convex:typecheckpnpm ops:test(45 tests, including 8 new OSV tests),node scripts/check-osv-exceptions.mjs,pnpm deps:provenance(verifiedvercel@58.4.4fromvercel/vercel@6331571)sandbox@0.8.6fails ("reachable outside the root Vercel CLI dependency"); removingvercelfails ("remove the stale OSV exceptions"). A local run of the new deploy guard passes when the manifest matches the installed CLI and fails closed when it doesn't.pnpm ingest:lint,pnpm ingest:test: not affected (both still pass)CHANGELOG.mdupdated under UnreleasedSummary by Sourcery
Make Vercel and OSV policy gates follow the dependencies and security conditions they protect instead of hand-edited version pins.
Bug Fixes:
Enhancements:
Documentation:
Tests: