Filter app runtime env vars from terminal spawn environment#44
Filter app runtime env vars from terminal spawn environment#44juliusmarminge merged 1 commit intomainfrom
Conversation
- build terminal spawn env from a filtered copy of process env - exclude `PORT`, `T3CODE_*`, `VITE_*`, and Electron runtime vars - add test coverage to verify filtered and preserved env keys
WalkthroughImplements environment variable filtering for spawned terminal sessions. A blocklist of sensitive variables (PORT, ELECTRON_RENDERER_PORT, ELECTRON_RUN_AS_NODE) and framework-specific prefixes (T3CODE_, VITE_) are excluded from the shell environment. New helper functions sanitize the environment before terminal spawn, with comprehensive test coverage validating the filtering behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
Filter terminal spawn environment in
|
Greptile OverviewGreptile SummaryAdds environment variable filtering to terminal spawn operations to prevent app runtime configuration from interfering with shell sessions.
Confidence Score: 5/5
Important Files Changed
Flowchartflowchart TD
A[startSession called] --> B[createTerminalSpawnEnv called with process.env]
B --> C{For each env key/value}
C --> D{value === undefined?}
D -->|Yes| E[Skip]
D -->|No| F{shouldExcludeTerminalEnvKey}
F --> G{Starts with T3CODE_?}
G -->|Yes| E
G -->|No| H{Starts with VITE_?}
H -->|Yes| E
H -->|No| I{In TERMINAL_ENV_BLOCKLIST?}
I -->|Yes - PORT, ELECTRON_RENDERER_PORT, ELECTRON_RUN_AS_NODE| E
I -->|No| J[Include in spawnEnv]
E --> K{More keys?}
J --> K
K -->|Yes| C
K -->|No| L[Return filtered spawnEnv]
L --> M[ptyAdapter.spawn with filtered env]
Last reviewed commit: ecea657 |
…ker gating Port upstream commits 9bb9023..b36888e: - Handle branch selection across main and secondary worktrees (pingdotgg#44) - Preserve fork PR upstreams when preparing local and worktree threads (pingdotgg#45) Adds resolveBranchSelectionTarget for unified checkout cwd/worktree decisions, GitCore helpers for remote management (ensureRemote, fetchRemoteBranch, setBranchUpstream), GitHub CLI cross-repo PR metadata parsing, and GitManager fork head materialization with upstream tracking.
Summary
PORT,ELECTRON_RENDERER_PORT,ELECTRON_RUN_AS_NODE, and any keys prefixed withT3CODE_orVITE_.Testing
apps/server/src/terminalManager.test.ts(filters app runtime env variables from terminal sessions) to verify:PORT,T3CODE_PORT, andVITE_DEV_SERVER_URLare excluded from terminal spawn env.TEST_TERMINAL_KEEPis preserved.Summary by CodeRabbit
Release Notes