fix(#7010): guard reserved sandbox keys against .env.d and host_files bypass - #7012
Open
fullsend-ai-coder[bot] wants to merge 1 commit into
Open
fix(#7010): guard reserved sandbox keys against .env.d and host_files bypass#7012fullsend-ai-coder[bot] wants to merge 1 commit into
fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
… bypass reservedSandboxKeys only blocked env.sandbox from shadowing runner-owned infrastructure variables, but two other harness-controlled routes could still override them: 1. .env.d sourcing happened midway through the bootstrap script, so a host_files entry landing a file in .env.d/ with expand: true could overwrite exports written above that line (e.g. FULLSEND_ROLE). 2. host_files entries with dest targeting the sandbox .env could replace the runner's bootstrap .env file wholesale, bypassing all guards. Fix route 1 by moving .env.d sourcing to the top of the bootstrap script so every runner-owned infrastructure export comes after it and takes precedence. Extract buildBootstrapLines for testability. Fix route 2 by rejecting host_files entries whose dest targets the runner's .env file, both at harness validation time and at runtime in bootstrapEnv as defense-in-depth. Note: pre-commit hooks were not run. pre-commit could not complete (infrastructure failure: sandbox network policy blocks git fetch for remote hook repos). Closes #7010
|
🤖 Review · ❌ Terminated · Started 3:24 PM UTC · Ended 4:06 PM UTC Commit: |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
🤖 Finished Review · ❌ Failure (validation failed after 2 iteration(s)) · Started 3:24 PM UTC · Completed 4:06 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $6.89 |
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
Guard reserved sandbox environment variables against bypass via
.env.dsourcing order andhost_filesdest targeting the runner's.envfile..env.dsourcing to the top of the bootstrap script so all runner-owned infrastructure exports (PATH, FULLSEND_ROLE, FULLSEND_OUTPUT_DIR, etc.) come after and cannot be shadowedhost_filesentries withdesttargeting/sandbox/workspace/.envat harness validation time and at runtime as defense-in-depthbuildBootstrapLinesfrombootstrapEnvfor testabilityChanges
internal/cli/run.go: ExtractbuildBootstrapLines, reorder.env.dsourcing before infrastructure exports, add runtime guard for host_files targeting.envinternal/harness/harness.go: AddsandboxBootstrapEnvFileconstant and validation inValidate()for host_files destinternal/harness/forge.go: Add same validation invalidateForge()andvalidateOverlayForgeConfig()internal/cli/run_test.go: Tests for.env.dordering, fetch vars, and schema export lineinternal/harness/harness_test.go: Tests for host_files dest validation (reject.env, allow.env.d/)internal/harness/forge_test.go: Test for forge-level host_files dest validationTesting
go vet ./internal/cli/ ./internal/harness/passesgo test ./internal/harness/passes (all tests)go test ./internal/cli/targeted tests pass (pre-existing failures in TestStartFetchService and TestPostScriptEnv are unrelated)Closes #7010
Post-script verification
agent/7010-guard-envd-hostfiles)fecb2f0809b7843ed188d99f8dba98fc4a0beb55..HEAD)