Scrub Pipelines secret pointers from agent environments (H3, layer 1)

New internal/agentenv drops every PIPELINES_* variable naming a token,
secret, password, auth file or key (except *_PUBLIC_KEY) from the
environment of processes started for agents: Claude stages and chats
(direct and hosted), Pi stages, OpenCode stage CLI calls and serve
processes, check commands, delivery-gate checks, `!` shell lines, the
run's workspace environment and turn-diff git snapshots. MCP servers are
children of the harness and inherit its scrubbed environment. The
interactive terminal is unchanged. An agent's `pipelines` CLI call falls
back to the default server-token location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 23:16:57 +00:00
parent e39a9560ba
commit b24fc31761
23 changed files with 503 additions and 37 deletions
+4 -2
View File
@@ -51,8 +51,10 @@ func main() {
if accessToken, err = servertoken.Read(*tokenFile); err != nil {
log.Fatalf("server token: %v", err)
}
// Stages, chat harnesses and their `pipelines` CLI calls inherit the
// file's location, never the token itself.
// Recorded for the server's own reads. Agent processes (stages, chat
// harnesses, `!` lines, checks) never inherit it: internal/agentenv
// drops it, and their `pipelines` CLI calls fall back to the default
// location (servertoken.DefaultPath).
_ = os.Setenv(servertoken.EnvKey, *tokenFile)
} else {
log.Printf("no server token configured (-token-file): local clients reach this server without the shared secret")