Skip to content

feat(install): require npm provenance for platform packages - #2440

Open
kazupon wants to merge 17 commits into
voidzero-dev:mainfrom
kazupon:issue-1826-platform-package-provenance
Open

kazupon wants to merge 17 commits into
voidzero-dev:mainfrom
kazupon:issue-1826-platform-package-provenance

Conversation

@kazupon

@kazupon kazupon commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #1826.

Vite+ previously accepted platform package metadata without requiring npm provenance, allowing an unverified release binary to reach the download path.

Require supported SLSA provenance before downloading standard release binaries through the standalone installers, vp upgrade, and vp-setup.exe.

Changes

  • Validate dist.attestations.provenance.predicateType against SLSA v1 and v0.2 in the shared Rust resolver.
  • Fetch and validate exact platform metadata in both standalone installers.
  • Fail closed before tarball download for missing, malformed, spoofed, or unsupported provenance.
  • Add one mock registry fixture and entrypoint coverage for all four install and upgrade paths.

Testing

  • cargo test -p vp_setup registry: provenance parsing, error classification, and download ordering.
  • just check, just test, just lint: workspace compilation, tests, and Clippy.
  • Mock-registry E2E: rejection before download and acceptance of SLSA v1/v0.2 across the installer and upgrade entrypoints.
  • Official npm release smoke test: an existing provenance-backed release still installs.

@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit e579506
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a990f854213470008f23d79

@kazupon
kazupon marked this pull request as ready for review August 13, 2026 06:03
@kazupon
kazupon requested a review from fengmk2 August 13, 2026 06:28
@kazupon

kazupon commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c8979569f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/install.sh Outdated
@fengmk2

fengmk2 commented Aug 21, 2026

Copy link
Copy Markdown
Member

@kazupon can you update install.ps1 too?

@fengmk2 fengmk2 self-assigned this Aug 21, 2026
@kazupon

kazupon commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

@fengmk2
Thanks!

If you're referring to the Codex path-spoofing finding, it was specific to install.sh, whose AWK parser previously flattened JSON paths into dot-joined strings. install.ps1 uses nested property access ($Metadata.dist.attestations.provenance.predicateType), so a dotted top-level key cannot satisfy the check.

I also added the dotted-top-level-key regression case to both installer test suites, and the PowerShell case rejects it.

Please let me know if you had a different PowerShell concern in mind 🙏

@fengmk2

fengmk2 commented Sep 10, 2026

Copy link
Copy Markdown
Member

@kazupon Thanks, I will verify it once, and if there are no issues, I will merge it.

@fengmk2

fengmk2 commented Sep 10, 2026

Copy link
Copy Markdown
Member

@kazupon I think we should wait for #2611 finish, the install flow will have a big refactor after that.

cc @liangmiQwQ

@kazupon

kazupon commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator Author

@fengmk2 no problem!
I can wait for it!

@fengmk2

fengmk2 commented Sep 12, 2026

Copy link
Copy Markdown
Member

@kazupon #2611 was merged, you can continue now!

@kazupon

kazupon commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator Author

@fengmk2
I've just fixed conflict!
You can check and review again!

@fengmk2

fengmk2 commented Sep 14, 2026

Copy link
Copy Markdown
Member

@codex review

@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test labels Sep 14, 2026
@fengmk2 fengmk2 added test: create-e2e Run `vp create` e2e tests test: sfw labels Sep 14, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T08:46:28.760002Z 5556537 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 5556537b1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2
fengmk2 requested a review from liangmiQwQ September 14, 2026 09:58

@liangmiQwQ liangmiQwQ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other LGTM :)

Comment thread packages/cli/install.sh
Comment thread packages/cli/install.ps1
@fengmk2 fengmk2 added the preview-build Publish this PR's commits to the registry bridge as preview builds label Sep 16, 2026
@fengmk2 fengmk2 changed the title fix(install): require npm provenance for platform packages feat(install): require npm provenance for platform packages Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Registry bridge build (85644fb)

Warning

This build is from the fork kazupon/vite-plus and has not been reviewed.
Installing it runs that code on your machine. Build log

This commit build is published to the registry bridge, which serves these as ordinary npm versions (every other package proxies to npmjs):

Package Version
vite-plus 0.0.0-commit.85644fb20281e9210840bf413e7dc377ad65fcd4
@voidzero-dev/vite-plus-core 0.0.0-commit.85644fb20281e9210840bf413e7dc377ad65fcd4

Install the Vite+ CLI built from this commit, then migrate a project:

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/kazupon/vite-plus/85644fb20281e9210840bf413e7dc377ad65fcd4/packages/cli/install.sh | VP_PR_VERSION=2440 VP_LEGACY_INSTALLER_URL=https://raw.githubusercontent.com/kazupon/vite-plus/85644fb20281e9210840bf413e7dc377ad65fcd4/packages/cli/install-legacy.sh bash
# Windows (PowerShell)
$env:VP_PR_VERSION="2440"; $env:VP_LEGACY_INSTALLER_URL="https://raw.githubusercontent.com/kazupon/vite-plus/85644fb20281e9210840bf413e7dc377ad65fcd4/packages/cli/install-legacy.ps1"; irm https://raw.githubusercontent.com/kazupon/vite-plus/85644fb20281e9210840bf413e7dc377ad65fcd4/packages/cli/install.ps1 | iex

Or download the standalone Windows installer built from this commit:

Architecture Installer
x64 vp-setup-x86_64-pc-windows-msvc.exe
Arm64 vp-setup-aarch64-pc-windows-msvc.exe

GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:

.\vp-setup.exe --version "0.0.0-commit.85644fb20281e9210840bf413e7dc377ad65fcd4" --registry "https://registry-bridge.viteplus.dev/"

After installing, upgrade the current project's vite-plus to this test build with:

vp migrate

Or point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:

Package manager Registry config
npm / pnpm / Bun .npmrc: registry=https://registry-bridge.viteplus.dev/
Yarn (v2+) .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/"

Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):

{
  "devDependencies": {
    "vite-plus": "0.0.0-commit.85644fb20281e9210840bf413e7dc377ad65fcd4",
    "vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.85644fb20281e9210840bf413e7dc377ad65fcd4"
  }
}

fengmk2 commented Sep 16, 2026

Copy link
Copy Markdown
Member

The standalone Windows preview installation command fails, because our bridge registry don't includes provenance field. We need to adapt to this issue.

.\vp-setup.exe --version "0.0.0-commit.85644fb20281e9210840bf413e7dc377ad65fcd4" --registry "https://registry-bridge.viteplus.dev/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-build Publish this PR's commits to the registry bridge as preview builds test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: sfw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject Vite+ install script if the @voidzero-dev/vite-plus-cli-* package does not have provenance

3 participants