feat(sandbox): per-environment egress policy + automatic git-platform egress injection#1340
Merged
Merged
Conversation
Hoist the host-derivation and `Basic oauth2:<token>` credential build into `RepoClient.get_git_egress_credential`; GitLab/GitHub now supply only the short-lived token via `_git_egress_token`, dropping the duplicated shape. Reject the reserved `__daiv_git_platform__` secret name at save time, so a stored secret/inject cannot silently shadow the runtime-injected git-platform credential. Also annotate `apply_platform_egress` / `augment_sandbox_with_platform_egress`, correct the CA env-var names (`DAIV_SANDBOX_EGRESS_CA_*`) in the egress-unavailable error, and reword the CHANGELOG credential description.
Merge worktree-egress-policy-ui, which drops the network_enabled flag and attaches egress at session-create time. Resolved the conflicts by porting the git-platform egress-injection feature onto the new model where a non-null egress policy is what marks an env as networked. - sandbox middleware: drop the orphaned _provision_egress; egress is now passed to start_session and the egress-proxy-unavailable case is handled at create - services/context: augment_sandbox_with_platform_egress gates on egress presence instead of the removed network_enabled flag - models: reconcile the egress_policy doc comment with the new model while keeping the git-platform injection notes - tests: migrate SandboxRuntime construction off network_enabled and assert injection against the egress-presence model
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
Stacked on top of the per-environment egress policy (#1336 → #1339; base
worktree-egress-policy-ui). This PR layers automatic git-platform egress injection on that policy: network-enabled sandbox environments now reach and authenticate their own repository's git platform (GitLab/GitHub) over HTTPS without any manual host configuration.Authorization: Basiccredential at the egress proxy, built from a short-lived, project-scoped token — the ephemeral clone token for GitLab (PAT fallback) and acontents: readinstallation token for GitHub — sogit fetch/clone of the repository works out of the box.__daiv_git_platform__is rejected at save time, so stored config cannot silently shadow DAIV's credential.Implementation notes
RepoClient.get_git_egress_credential(host derivation +Basic oauth2:<token>build); platform clients supply only the token via_git_egress_token.apply_platform_egress/augment_sandbox_with_platform_egressmerge the platform rule onto the runtimeSandboxRuntime.egressat context setup, leaving the stored policy untouched.Testing
uv run pytest tests/unit_tests/codebase/test_context.py tests/unit_tests/sandbox_envs/test_models.py— passes (67).make lint/ ruff — clean.