Skip to content

feat(cloud-agent-next): keep managed Git credentials out of sandboxes#3665

Open
eshurakov wants to merge 2 commits into
mainfrom
feat/cloud-agent-managed-scm-containment
Open

feat(cloud-agent-next): keep managed Git credentials out of sandboxes#3665
eshurakov wants to merge 2 commits into
mainfrom
feat/cloud-agent-managed-scm-containment

Conversation

@eshurakov
Copy link
Copy Markdown
Contributor

Summary

  • Replace sandbox-visible managed GitHub and GitLab credentials with short-lived encrypted capabilities redeemed by git-token-service through sandbox outbound interception.
  • Bind capabilities to the repository, provider auth surface, selected credential identity, and outer Sandbox Durable Object container ID so replay from another sandbox fails closed before provider lookup.
  • Preserve staged rollout compatibility for legacy unbound capabilities during the one-hour lifetime window, and propagate Cloudflare runtime HTTPS-interception trust into nested DIND devcontainers.
  • Add standard and DIND outbound rewrite probes plus focused coverage for capability issuance, redemption, redirects, LFS paths, GitLab CLI surfaces, and replay rejection.

Verification

  • Manually exercised the real-Git outbound rewrite probes for standard sandbox and DIND containment paths during implementation.
  • Did not rerun manual probes during the final history cleanup; no UI or visual surface changed.

Visual Changes

N/A

Reviewer Notes

  • Deploy in order: provision the SCM capability secret, deploy rollout-compatible git-token-service, then deploy cloud-agent-next.
  • Remove temporary unbound kgh1.* / kgl1.* issuance and redemption support after the one-hour compatibility window.
  • GitLab intentionally allows broad authenticated /api/v4/** and /api/graphql access for glab; Git smart HTTP and LFS control paths remain repository-bound.

Comment thread services/git-token-service/src/index.ts Outdated
Comment thread services/git-token-service/src/index.ts Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Jun 2, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commit (41b2b497e) resolves the sole remaining WARNING by introducing a dedicated 'integration_identity_missing' error code when getGitLabSessionIdentity returns null, replacing the misleading 'no_token' mapping. The fix is complete: type union updated in both git-token-service and cloud-agent-next, user-facing message added to gitLabTokenLookupFailureMessage, and a targeted test case confirms the new behavior.

Resolved Issues
File Line Issue Status
services/git-token-service/src/index.ts 832 getGitLabSessionIdentity returning null was mapped to reason: 'no_token' (misleading — actual cause is missing integration identity, not missing token) ✅ Fixed in 41b2b497e
Files Reviewed (5 files in incremental diff)
  • services/git-token-service/src/index.ts — WARNING resolved
  • services/git-token-service/src/index.test.ts — new test coverage for integration_identity_missing
  • services/cloud-agent-next/src/types.ts'integration_identity_missing' added to IssueGitLabSessionCapabilityResult union
  • services/cloud-agent-next/src/session-service.ts — user-facing message case added
  • services/cloud-agent-next/src/session-service.test.ts — test case for the new message

Fix these issues in Kilo Cloud


Reviewed by claude-4.6-sonnet-20260217 · 270,476 tokens

Review guidance: REVIEW.md from base branch main

@eshurakov eshurakov force-pushed the feat/cloud-agent-managed-scm-containment branch from 410282b to ec9e82d Compare June 4, 2026 15:50
@eshurakov eshurakov force-pushed the feat/cloud-agent-managed-scm-containment branch from ec9e82d to c95c292 Compare June 4, 2026 19:33
@eshurakov eshurakov changed the title feat(cloud-agent-next): contain managed SCM credentials feat(cloud-agent-next): keep managed Git credentials out of sandboxes Jun 5, 2026
Copy link
Copy Markdown
Contributor

@pandemicsyn pandemicsyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, one thing inline. Based on the PR body not entirely sure if this is actually breaking the implied security contract or not.

);
const upstreamFailure =
claims.version === 2
? validateGitHubCapabilityUpstream(params.requestUrl)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok robot flagged this:

"v2 GitHub capabilities are host-scoped rather than repo/path-scoped during redemption, allowing sandbox code to exchange a repo capability for a real token on any allowed GitHub host endpoint that the underlying token can access.

So a capability issued for acme/repo can be redeemed for requests like:

I think its interpreting that as a regression based on this comment in the PR body:

Bind capabilities to the repository, provider auth surface, selected credential identity, and outer Sandbox Durable Object container ID so replay from another sandbox fails closed before provider lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants