fix: pin shadcn version instead of @latest in shadcn_add.py#284
Open
xiaolai wants to merge 1 commit intonextlevelbuilder:mainfrom
Open
fix: pin shadcn version instead of @latest in shadcn_add.py#284xiaolai wants to merge 1 commit intonextlevelbuilder:mainfrom
xiaolai wants to merge 1 commit intonextlevelbuilder:mainfrom
Conversation
This was referenced Apr 26, 2026
npx shadcn@latest silently downloads whatever npm publishes as latest on each run. Replace with a _get_shadcn_version() helper that reads the installed shadcn version from the project package.json when available, falling back to a pinned default (2.3.0). This ensures reproducible installs and eliminates unverified-at-runtime supply chain drift. Co-Authored-By: Claude Code <noreply@anthropic.com>
537ea77 to
b029e79
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security Fix (Medium)
`.claude/skills/ui-styling/scripts/shadcn_add.py` calls `npx shadcn@latest add` which silently downloads and runs whatever version npm has tagged as `latest` at the time of each invocation. While list-form `subprocess.run` prevents shell injection, the package itself is unverified at runtime — a supply-chain compromise of the `shadcn` npm package would be automatically installed on the next run.
Fix: Add a `_get_shadcn_version()` helper that:
This ensures installations are reproducible. The pinned fallback version in the helper comment makes the version visible and easy to update deliberately.
Applied to both `add_components()` and `add_all_components()`.