fix(v2): strip CLAUDE* env vars at Rust level in SidecarManager
Add env_clear() + envs(clean_env) to Command in SidecarManager to filter all CLAUDE-prefixed environment variables before spawning the sidecar process. This provides primary defense against SDK nesting detection when BTerminal is launched from a Claude Code terminal. The JS-side stripping via SDK env option is retained as defense-in-depth.
This commit is contained in:
parent
f97e7391a9
commit
a3d9933221
1 changed files with 8 additions and 0 deletions
|
|
@ -61,8 +61,16 @@ impl SidecarManager {
|
|||
|
||||
log::info!("Starting sidecar: {} {}", cmd.program, cmd.args.join(" "));
|
||||
|
||||
// Build a clean environment stripping all CLAUDE* vars to prevent
|
||||
// the SDK from detecting nesting when BTerminal is launched from a Claude Code terminal
|
||||
let clean_env: Vec<(String, String)> = std::env::vars()
|
||||
.filter(|(k, _)| !k.starts_with("CLAUDE"))
|
||||
.collect();
|
||||
|
||||
let mut child = Command::new(&cmd.program)
|
||||
.args(&cmd.args)
|
||||
.env_clear()
|
||||
.envs(clean_env)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue