Conversation
npm publish requires a one-time password when 2FA is enabled. The script now prompts for the OTP code before publishing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThe release script now requires npm One-Time Password (OTP) authentication. A prompt collects the OTP code from the user before executing the npm publish command, which includes the OTP flag. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
Greptile OverviewGreptile SummaryAdds an OTP prompt before
Confidence Score: 2/5
Important Files Changed
Flowchartflowchart TD
A[Start Release Process] --> B[Run Tests]
B --> C{Tests Pass?}
C -->|No| D[Abort Release]
C -->|Yes| E[Build Package]
E --> F[Confirm Publish]
F --> G{User Confirms?}
G -->|No| D
G -->|Yes| H[Prompt for OTP]
H --> I[Execute npm publish with OTP]
I --> J{Publish Success?}
J -->|No| D
J -->|Yes| K[Update VERSION File]
K --> L[Commit and Tag]
L --> M[Push to GitHub]
M --> N[Release Complete]
Last reviewed commit: ba69b2e |
| const otp = readline.question('Enter your npm OTP code: ') | ||
|
|
||
| log('Publishing...') | ||
| if (exec(`cd ${outDir} && npm publish --access public `).code !== 0) { | ||
| if ( | ||
| exec(`cd ${outDir} && npm publish --access public --otp=${otp}`).code !== 0 |
There was a problem hiding this comment.
Command injection vulnerability: the OTP input is directly interpolated into a shell command without validation. If a user enters 123456; rm -rf /, it would execute the malicious command. Validate that OTP contains only digits (typically 6 digits).
| const otp = readline.question('Enter your npm OTP code: ') | |
| log('Publishing...') | |
| if (exec(`cd ${outDir} && npm publish --access public `).code !== 0) { | |
| if ( | |
| exec(`cd ${outDir} && npm publish --access public --otp=${otp}`).code !== 0 | |
| const otp = readline.question('Enter your npm OTP code: ') | |
| // Validate OTP is numeric | |
| if (!/^\d{6}$/.test(otp)) { | |
| logError('Invalid OTP format. OTP must be 6 digits.') | |
| exit(1) | |
| } | |
| log('Publishing...') | |
| if ( | |
| exec(`cd ${outDir} && npm publish --access public --otp=${otp}`).code !== 0 | |
| ) { |
Summary
npm publishin the release scriptEOTPwhen 2FA is enabledTest plan
yarn releaseand verify OTP prompt appears before publish step🤖 Generated with Claude Code
Summary by CodeRabbit