fix(sidecar_init): scope EGRESS_TOKEN_* to egress daemon only (issue #84) #85
Reference in New Issue
Block a user
Delete Branch "sidecar-init-scope-egress-tokens-issue-84"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #84.
Summary
Pipelock was 403-blocking the very
Authorizationheader egress had just injected —blocked: request header contains secreton any in-bottle request to a host with anauth_schemeroute. Self-DOS by the bundle's two DLP-aware proxies.Root cause
Chain is
agent → egress → pipelock → internet. Egress injectsAuthorization: Bearer <token>for configured routes, then forwards upstream. Pipelock hasscan_env: true+scan_headers: true+header_mode: all, and the bundle supervisor spawned every daemon (egress, pipelock, git-gate, supervise) inheriting the bundle container's full env — including theEGRESS_TOKEN_<n>slots set viadocker run -e. Pipelock had the token value egress injected sitting in its own env, matched it in headers, blocked.The agent runs in a different machine and never sees
EGRESS_TOKEN_*, so stripping these from non-egress daemons loses no DLP coverage.Changes
_env_for_daemon(name, base_env)inclaude_bottle/sidecar_init.py: returns the unchanged base foregress, a copy withEGRESS_TOKEN_*filtered for everyone else. Prefix-based so future egress-only slots don't need code changes._spawnnow passes the scoped env tosubprocess.Popen.Tests
TestEnvForDaemon(new, 4 cases): egress gets full env; pipelock / git-gate / supervise loseEGRESS_TOKEN_0+EGRESS_TOKEN_1but keepPATH/EGRESS_UPSTREAM_PROXY/SUPERVISE_PORT; returned dict is independent of the source.642 unit tests pass.
Stacking
Branches off main directly. Touches
claude_bottle/sidecar_init.pyonly — no manifest, no provisioning, no protocol changes.