Repository navigation
feat: add credentialed git for remote sessions - #21256
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the credential stays on the gateway, every forwarded request passes the Notes
[DESIGN-REVIEWED] 1cb9be4 Description read[DESCRIPTION-READ] 20507a58533c592712f61d2e9e91f783e0a7fb246b5ff5a37e783444e469170a That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item is behind What this change shipsInventory (10 items) — 10 justifiedIntent: let git in a remote Coder workspace clone, fetch and push private repositories on the four big hosts, using the gateway's login, without putting a credential in the workspace. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 1cb9be4 Description read[DESCRIPTION-READ] 89e749b992aa7dbbb65cd0a5873e8ac8336a31daedb2f29a2a8030ab993a38e5 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the Windows-gateway readiness line ( Evidence gaps
Notes
[UX-REVIEWED] 1cb9be4 Description read[DESCRIPTION-READ] f6107099c87029444c26fa5e6017344f0cb9809f8eb007799952673e2ca49c81 That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
aff2e76 to
442ebb2
Compare
6b91cb7 to
47b1810
Compare
5da3123 to
9c027ca
Compare
9c027ca to
91efcec
Compare
|
GPT F3 on |
|
GPT finding F1 (
Tests:
|
|
GPT finding F1 ( The stack moves bottom-up once B is green, so this push is held until then.
|
|
GPT finding F1 (
|
|
GPT finding F1 (
|
|
GPT 6.1 — subagent sessions drop the owning app ( The finding was correct. Neither subagent session claim in Fix: Test: |
|
Opus 5.5: blocking Windows ACL/SID calls on the event loop ( The finding was correct. Fix: the new
Test: |
|
GPT 6.1 — upload backpressure hides The finding was correct: Fix: per-request credit flow control, so buffering stays bounded without the reader ever waiting.
Tests (each fails with its part reverted):
The real-git clone/push end-to-end tests pass through both new sides; 3920 scoped tests, Backend Lint and Fast Gate pass. |
|
GPT 6.1 — a protected-branch refusal hangs large push uploads ( The finding was correct: a push refused for a protected branch is answered in git's own report-status as Fix: Test: The same push also replaces two fixed sleeps in those tests (Semgrep |
|
GPT 6.1 — close stdin before The finding was correct: on Python 3.12 Fix (test-only, one line): the explicit |
|
Opus 5.5 — the readiness check drops the git rows when the Coder client can't be built ( The finding was correct: the Fix: that arm now returns Test: |
|
HOLD at dcf6f4b. The base is On this head all AI lanes pass and CI is green. Every earlier GPT and Opus finding has an author reply. One open item needs a human: the First Principles lane notes that Kiro Cloud Sessions is outside the PR's stated Goal, and the description's note that a maintainer ruled to keep it here is not recorded by a maintainer on the PR. Clears when: the lower stacked PRs merge and this one is retargeted to — crew-pr-reviewer (r124) |
|
Re: GPT 6.1 blocking finding on The finding was right, and the reach was wider than gateway restarts:
|
|
Re: GPT 6.1 blocking finding on Resume stays persistent-only, so incognito and temporary keep their promise of not reopening a native session. Instead they never reach the cloud, at all three places a cloud placement can come from:
Each of the three tests fails when its site is reverted. Memory mode only tightens, so the strictest known mode (a committed tightening included) decides. The spec ( |
|
Re: GPT 6.1 blocking finding on The finding is right: these fixtures point
No product code changed. |
|
Re: Opus 5.5 blocking finding on The finding is right: the field showed Squashed to stay within the 2-commit cap ( @@ export function SessionEnvironmentsCard() {
const [openCloudRows, setOpenCloudRows] = useState<boolean[]>([])
+ // What the person typed in each Kiro Cloud row's repositories field. The field
+ // shows this, not the array rebuilt from it, so a separator they delete stays
+ // deleted; the array is still what saves (cleaned by withCleanRepositories).
+ const [repoText, setRepoText] = useState<(string | undefined)[]>([])
@@ onSuccess
setDraft(null)
+ setRepoText([])
setSaved(true)
@@ the repositories input
- value={field.key === 'repositories' ? profile.repositories.join(', ') : profile[field.key]}
- onChange={value => updateCloud(index, field.key === 'repositories'
- ? { repositories: value.split(',').map(r => r.trim()) }
- : { [field.key]: value })} />
+ value={field.key === 'repositories'
+ ? repoText[index] ?? profile.repositories.join(', ')
+ : profile[field.key]}
+ onChange={value => {
+ if (field.key !== 'repositories') return updateCloud(index, { [field.key]: value })
+ setRepoText(texts => { const next = [...texts]; next[index] = value; return next })
+ updateCloud(index, { repositories: value.split(',').map(r => r.trim()) })
+ }} />
@@ remove row
setOpenCloudRows(rows => rows.filter((_, i) => i !== index))
+ setRepoText(texts => texts.filter((_, i) => i !== index))
@@ Discard
setOpenCloudRows([])
+ setRepoText([])Test: |
|
Re: Opus 5.5 blocking finding on The finding was correct. After every Test: Notes: |
|
Re: GPT 6.1 blocking finding on The finding was correct, at both sites it names. The exact delta: - if default and default not in _profile_ids(section):
+ if default and (not isinstance(default, str) or default not in _profile_ids(section)):
del section["default_profile"]
-def _profile_ids(section: dict) -> set[object]:
+def _profile_ids(section: dict) -> set[str]:
return {
- item.get("id")
+ item["id"]
for entries in section.values()
if isinstance(entries, list)
for item in entries
- if isinstance(item, dict)
+ if isinstance(item, dict) and isinstance(item.get("id"), str)
}
Test: |
|
Re: Opus 5.5 blocking finding on The finding was correct. Splitting Kiro Cloud out of this PR had left the code that sets
Test: |
|
Re: GPT 6.1 blocking finding on The finding was correct, and so was the adjudication's point that the relay's bearer header would reach the proxy operator in the same request. Test: |
|
Re: Opus 5.5 blocking finding on The finding was correct. The subagent was only meant to carry the app's governance, and on main a subagent never took the app's model. The spawn now passes the app as Tests in |
Git from a remote session workspace goes through a gateway-side proxy that holds the credential, with an audited egress check under the session key, for each host the gateway can lend a login for; every other host keeps the workspace's own git login, and the strict sandbox lends none. Pushes follow the local rule: one that updates or deletes a protected branch is refused whole, using the git-publish check's own branch list, and every other push goes through unprompted.
The git proxy's egress check reads provider.owning_app, which nothing set on the git half: session allocation now sets it from the caller's slot app (never transcript metadata) at both provider creation sites, and AcpProvider initialises it.
|
HOLD at 1cb9be4: this lends the gateway's git logins to remote workspaces over a new network route, so a human maintainer reviews it. Both blockers from our r124 HOLD are gone: the base is now AI findings judged non-blocking:
I read the AI lanes, the replies and the security-critical code. I did not run tests. — crew-pr-reviewer (r134) |
Problem / Motivation
Goal: Let git in a remote session's workspace reach private repositories on GitHub, GitLab, Bitbucket and Azure DevOps without any credential ever being stored in that workspace.
A session on a Coder workspace (#19833) runs its shell in the guest, but the guest holds no git login.
git cloneof a private repository fails,git pushfails, and the only workaround is to copy a token into a disposable machine the user does not fully control. The dashboard's Git view also shows the gateway's local checkout, which is the wrong machine for a remote session.Why it matters
Most real work in a remote session ends in a clone, a fetch or a push. Without git access the remote workspace is only good for public code, and pasting tokens into guests spreads long-lived secrets onto machines that are created and thrown away all day. Keeping the credential on the gateway gives remote sessions working git while the secret stays where the user already keeps it.
Not a goal
github.com,gitlab.com,bitbucket.organddev.azure.com(self-hosted GitLab, GitHub Enterprise, Azure's legacyORG.visualstudio.comURLs).Known limitation: an organisation-scoped git credential helper (
credential.https://dev.azure.com/<org>.helper) isn't matched yet, because the gateway asks its helper per host with no repository path. Host-scoped helpers (credential.https://dev.azure.com.helper,credential.helper) andaz loginwork. With only an org-scoped helper, Azure is not lent (its git uses the workspace's own login), and the refusal and the gateway log name the setting to use; pinned bytest_an_organisation_scoped_helper_fails_closed_and_says_what_to_set.Windows gateways: credential lending works on Windows. Git runs every credential helper through
sh -c, and Git for Windows'shis not on the trustedPATH, so there_fill_directlyruns each validated helper executable itself. It follows git's config order, list resets and host-scoped keys, and speaks the helper protocol on stdin and stdout. The secret is in no argv, environment or file. Git Credential Manager besidegit.exe(mingw64\bin) is accepted under the same protected-install walk. A timed-out or cancelled lookup kills the whole process tree. The relay token file gets an owner-only DACL that is read back before the token is written; otherwise the file is removed and the launch fails. A Windows gateway that cannot read its own SID or the security-descriptor API lends nothing (lending_unverifiable, audited aswindows-unverified). POSIX behaviour is unchanged. With #23498 (remote workspace paths matched as POSIX on any gateway, now on main), a remote workspace starts on a Windows gateway too, so lending works there end to end. Tests:test_remote_git_windows_lending.py, plus the two real-git helper-isolation tests, which now assert on Windows that lending works and that no repository, environment or crafted helper ran.What changed (motivation → approach → change)
Git in a remote workspace works for private repositories on the four hosts, and the credential never leaves the gateway. The remote Git panel is not in this PR: at the maintainer's request it is its own PR, stacked on this one (see Stack).
The guest runs a small HTTP proxy on loopback. Each command the agent runs gets git's environment config (
GIT_CONFIG_COUNT, no config file written) that points the HTTPS and SSH spellings of each host the gateway can lend a login for at that proxy. Other hosts keep the workspace's own git login. Where both have a login for a host, the gateway's is used: lending by default outsidestrictis the maintainer's decision (strictis the opt-out; chosen over per-tier lending, sostandardandccalso lend logins they hide locally, such as Azure's), and routing only lendable hosts is the stack conductor's ruling. The proxy sends each request over the session's existing authenticated worker link. The gateway checks it, adds the login, and streams the answer back.ccsandbox, host the gateway is signed in toGIT_ASKPASS), as it would without Kiro Crewstrictsandboxccsandboxmainand the other names the local git-publish check protects, in any spelling:refs/heads/main,refs/remotes/origin/main, any case)! [remote rejected] … (protected branch)per ref and aremote: Kiro Crew: …line saying whystrictsandboxgh auth login,glab auth login,az login), or can't be checked, so git will use the gateway's saved login if any (Bitbucket, which has only git's credential helper; the row says to clone a private repository over HTTPS on the gateway so the helper saves the login). Understrict, one row instead: no login is shared and each workspace uses its own, with a link to the agent sandbox setting on Developer › Config. Each state has its own muted glyph; red stays for Coder and template failuressrc/kiro_crew/remote_session/git_proxy.pycancelframes for abandoned requestssrc/kiro_crew/remote_session/git_gateway.pyGitProxyChannel: smart-HTTP endpoints only, per-host repository-path shapes, upstream URL rebuilt from validated parts;network.egresscheck per request for the calling agent and the session's owning app (vet_and_audit(agent=..., app=...), so an app profile that denies a host also governs git; fail-closed, audited); the sandbox tier read on every request (an unreadable tier lends nothing); the protected-branch rule on eachgit-receive-packbody (PushCommands,is_protected_ref, reusing the local check's_PROTECTED_BRANCHESand_normalize_refrather than a copy); one SEL row per push decision; LFS batch calls sent to their direct endpoint without a logingh,glab,azor git's credential helper, each executable checked withvalidate_provider_executable(require_protected=True); a minimal child environment; only fixed built-in helper names (store,cache,osxkeychain,manager,manager-core,libsecret,wincred, exactgh auth git-credential); logins cached in memory for five minutes and never loggedsrc/kiro_crew/remote_session/workspace_tools.pysrc/kiro_crew/coder,src/kiro_crew/providers,src/kiro_crew/acpgit_proxy.pyto the guest; the agent's notice says git works, the workspace holds no keys,strictrefuses private reads and pushes, and a protected-branch push is refused as locallysrc/kiro_crew/platform,src/kiro_crew/change_card_catalog_kinds.pyvet_and_audittakes the agent; the code-exec note names git credentialssrc/kiro_crew/dashboardgitmap, fromgit_readiness()(status commands only;withheldfor every host understrict)website/src/pages,website/src/api,website/src/i18n,website/src/hooksGitLoginStatus, a link to the agent sandbox row on Developer › Config (anagent.sandboxhighlight anchor), strings in all 13 catalogs;Bitbucketadded to the brand allowlist and glossarydocs/system-specs/modules/providers.md,docs/system-specs/modules/governance.mdWhat the launch secret does and does not protect: each proxy has its own random secret, given to that session's tool server over stdin. A command in another session's tools cannot use this session's proxy by accident. A deliberately malicious process running as the same OS user in the same guest can still read that secret, because nothing separates processes of one user there.
Pushes follow the native-session rule at the maintainer's request: there is no approval card. The rule covers pushes routed through the proxy only; a push made with the workspace's own login goes straight to the forge, as from any machine holding that key, and no other mechanism stands in front of it. The proxy refuses a push whose destination refs include a protected branch, judged by the local git-publish check's own branch list and ref normalisation (on the refs git sends, after it resolves a bare or
--allcommand), and lets every other push through. The same-user limit applies to pushes too: any process in the workspace can push a feature branch (a force-push included), as any local process can on the gateway. The login lent is the gateway's whole login for that host, not one scoped to the session's repository, so such a push can reach any repository that login can write to, exactly as the samegh/glab/azlogin can from a local session.The spawn audit lists the two new gateway calls (
git_gateway.py::_run_quietfor credential reads,git_gateway.py::login_statusfor readiness), each with fixed verbs and a host fromHOSTS. Scanner and ratchet baselines are unchanged.Stack. #19833 (A, Coder backend), #22238 (B, UI and dashboard API) and #21259 (health card) are on main. This PR (credentialed git) targets main. Next comes the Kiro Cloud Sessions PR, stacked on this one, then #21257 (Sprites, boxd), #21258 (Fargate) and #21995 (remote Git panel). Until the Git panel PR lands, a remote session's Git tab shows #19833's notice.
On this move (onto main, Kiro Cloud split out)
4beecef5f2). Two additive conflicts:website/src/hooks/useSettingHighlight.test.tskeeps main's desktop-app close row next to this PR's agent-sandbox row, andSessionEnvironmentsCard.tsxkeeps main'sRawDetailsnext to this PR's status-glyphCheckLine.docs/feature-map/README.md: thesession-environmentssettings row now names../overview/agentSandboxLink.ts(the strict-sandbox link this PR adds), as main's feature-map gate requires for a new file underpages/.prepare_for_session'sagentargument assertion intest_remote_git_governance.py, and thechosen_providerpatch intest_session_environments_developer_flag.py. Nothing in this PR imports, names or configures Kiro Cloud./usr/local/bin) is found in the trusted system directories and still must pass the protected-binary check; each host's login is looked up concurrently under its own lock, published per host until the first full list is out; a git command run before the gateway answers the proxy's firstlendwaits up to 20 s, so a first private clone right after start is routed with the gateway's login.Backwards compatibility
Compatible: the proxy runs only for sessions on a remote environment;
vet_and_auditgains an optionalagentkeyword; the check response gains agitfield; local sessions are untouched. A provider CLI or credential helper that the gateway user can overwrite (for example a user-owned Homebrew install, or a custom helper script) is not used for remote git; remote git is new in this PR, so no working setup loses it.Removes nothing: every change adds to the remote-session path; no existing setting, endpoint or browse op is renamed or dropped.
Tests
test/test_remote_git_proxy.py: a realgitclone and feature-branch push through the real guest proxy and gateway channel againstgit http-backendon all four hosts' path shapes; the token never reaches the guest; only hosts the gateway can lend for are routed: a host with no gateway login keeps the workspace's own URL andGIT_ASKPASS(fails with routing forced on for every host),strictand no-login publish an empty list and route nothing, a list naming another proxy's port routes nothing, a lendable host still gets the protected-branch refusal, and an upstream 401 republishes the list at once, a refused login staying unlent until its source returns a new one; a crafted[credential "…=…"]subsection in~/.gitconfigruns nothing (real git); realgit pushto every protected name,refs/heads/main,+HEAD:main,:main,HEAD:MAIN,refs/remotes/origin/main, and a feature-plus-protected push are each refused whole with refs unchanged and nothing sent upstream; a force-push and a delete of a feature branch go through; the parser reads commands however the body is framed and refuses 13 malformed shapes; the proxy's predicate agrees with the local check's on 8 ref spellings; a refusal stays inside the side-band packet limit for refs up to 65 KB; a rejected credential never makes git prompt; egress is judged before any credential is read; the sandbox tier decides lending (governance floor included, unreadable tier lends nothing);strictreads anonymously, names itself on a private read and refuses pushes, feature branches included; an unparseable config or one whose top level is not an object lends no login (the loader stands defaults in rather than raising); every push decision (allowed, protected, unreadable, strict) and every request refused before the egress check writes one SEL row, and a failed SEL write changes no answer; readiness reportswithheldunderstrict. Withis_protected_refforced to False, 15 of these tests fail.test/test_remote_git_credential_isolation.py: repository, environment and shell helpers are never run; an agent-plantedgh/glab/azis never executed; overrides need protected provenance;credential fillreads a validated snapshot, not live config; per-launch secret.test/test_remote_git_proxy_admission.py,test/test_remote_git_channel_bounds.py,test/test_remote_git_cancellation.py: the 16-request limit, wire backpressure through the link's own consumer gate (a paused git reader never trips the stall check), cancelling one request without stalling others, real LFS clone/smudge and pre-push through the redirect.test/test_remote_git_proxy_port_file.py,test/test_remote_git_governance.py: each proxy's own port file (no shared default on either side), the calling agent carried from provider start to the audited egress check, refusal with no agent.test/test_remote_session_launch.py,test/test_spawn_audit.py: the proxy stops when its runtime ends normally, an older relay closing does not stop the live proxy, the agent notice is true on every tier, audit entries.website/src/test/SessionEnvironmentsCard.test.tsx: one row per git host with its sign-in command, and thestrictrow instead of a sign-in report.3dc2964c94; the patch is identical, by range-diff, to the one gated on mained694b8f03): every changed test file plustest_session_environment_handlers,test_coder_session_launch,test_change_cards,test_session_environments_config_apiand every facade test, 4473 passed (test_cli_doctor_refactor_facade'sPathcase fails only under this machine's Python 3.13,pathlib._local); the Fast Gate checks (30), black, isort, flake8, mypy and the file-line cap (15);tsc --noEmit, eslint on the 10 changed TS/TSX files,i18n:check;push_guard. No home-directory path in added lines; no Sensitive Change Review path touched.Manual verification
main, under both a standard and astrictsandbox.Screenshots / video
Rendered from this head's built dashboard on a loopback server with every API call answered from fixtures (no gateway, no workspace).
Settings › Verify readiness: GitHub signed in, GitLab and Azure DevOps not signed in with the command to run, Bitbucket not checked:
The same check under the
strictsandbox: no host's login is lent:Where that row's link lands: Developer › Config, with the Sandbox row highlighted:
A push has no screen of its own: a refused protected-branch push shows in git's own output (see the table above).
Light theme
Related Issues
Part of #10433
no linked issue: this PR closes nothing; #10433 stays open until the whole Session Environments stack lands.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license (see the Licensing section of CONTRIBUTING.md).