feat: env var injection + per-service scrub toggle (Plan 7)#208
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire service fake credentials into the spawned agent's environment via inject.env, with collision detection against env_inject, and make response scrubbing conditional per service via scrub_response. Changes: - Extend resolver to extract inject.env and scrub_response from policy YAML - BuildServiceEnvVars maps service fakes to env var names (OS-aware case folding) - Validate inject.env names in ValidateSecrets (empty, invalid chars, duplicates, reserved AGENTSH_ prefix) - CheckEnvCollisions detects env_inject vs service env var conflicts - Wire env vars through Session + StartLLMProxy with collision detection - Inject service fake credentials into all exec paths (exec, streaming, PTY) - Per-service scrub_response toggle in CredsSubHook (nil=scrub all for backward compat, empty map=scrub none, populated=selective) - Composition test covering full injection + collision + scrub flow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inject.envpolicy config, with collision detection against operatorenv_injectscrub_responseflag inCredsSubHookinject.envnames at policy load time (empty, invalid chars, cross-service duplicates, reservedAGENTSH_prefix with case-insensitive check)GITHUB_TOKENare in the default-deny listTest plan
BuildServiceEnvVars(happy path, unknown service, empty input, duplicate name, OS-aware case folding, nil table, invalid name)CheckEnvCollisions(no collision, single/multiple collisions, both nil, case-insensitive on Windows)ValidateSecretsinject.env validation (empty name, invalid char, duplicate, valid, reserved prefix case-insensitive)CredsSubHookscrub toggle (disabled, enabled, nil map backward compat)Session.ServiceEnvVars(nil, set, deep copy)go test ./...passesGOOS=windows go build ./...cross-compile passes🤖 Generated with Claude Code