fix(desktop): prevent env var leak in persistent terminal subprocess#785
fix(desktop): prevent env var leak in persistent terminal subprocess#785
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModified PTY spawn environment construction to use only the provided environment (plus TERM) instead of merging with host process.env. Creates sanitized subprocess environment from host process.env. Forces TERM to 'xterm-256color'. Prevents NODE_ENV leakage from parent process. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
The subprocess (pty-subprocess.js) was spawned with raw process.env, which includes NODE_ENV and other vars that should be filtered. Now uses the same filtered processEnv for both subprocess and PTY shell.
c42368c to
3e7ea8f
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
Fixes environment variable leak in persistent terminal sessions that was causing
bun devto fail withNODE_ENV=production.Change
The subprocess (pty-subprocess.js) was spawned with raw
process.env, which includesNODE_ENVand other vars that should be filtered. Now uses the same filteredprocessEnvfor both the subprocess and PTY shell.Test Plan
echo $NODE_ENVreturns emptybun dev- should work without env validation errors