fix: avoid exposing all system env vars in Vite define config#467
Conversation
WalkthroughThe Vite configuration for the fluent-editor documentation site was modified to restrict environment variable exposure. Instead of spreading all environment variables under ChangesEnvironment Variable Restriction
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Microsoft Presidio Analyzer (2.2.362)packages/docs/fluent-editor/vite.config.tsMicrosoft Presidio Analyzer failed to scan this file Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@packages/docs/fluent-editor/vite.config.ts`:
- Around line 21-26: The current define block sets 'process.env' to an object
which will shadow all process.env accesses; instead, replace the top-level
'process.env' define with per-key defines for the four tokens
(npm_package_devDependencies_vite, npm_package_devDependencies_vitepress,
npm_package_dependencies_vue, npm_package_dependencies_quill) so only those
exact access paths are replaced; for each key (refer to those exact identifiers
in vite.config.ts) set its value to a JSON.stringify'd string (or fallback to
the literal "undefined" string) rather than embedding an object, and leave
process.env.NODE_ENV and other env keys untouched so Vite's internal
replacements continue to work.
- Around line 21-26: The current define block replaces the entire 'process.env'
object (in vite.config.ts) which shadows standard env vars; change it to
individual per-key definitions instead of a single 'process.env' object: define
each key like 'process.env.npm_package_devDependencies_vite',
'process.env.npm_package_devDependencies_vitepress',
'process.env.npm_package_dependencies_vue', and
'process.env.npm_package_dependencies_quill' and set their values using
JSON.stringify(process.env.<KEY>) so undefined becomes explicit; update the
define entry where 'process.env' is currently set to create these four per-key
mappings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d84baf96-2c20-40d7-ab32-67ded855f07c
📒 Files selected for processing (1)
packages/docs/fluent-editor/vite.config.ts
Summary
'process.env': { ...process.env }invite.config.tswith only the 4npm_package_*variables actually consumed byinsert-deps-version.tsin the browserSummary by CodeRabbit
Note: This is an internal configuration adjustment with no user-facing changes or new functionality.