Skip to content

fix(apps): let owner manifest, blob and art clones reach the ssh agent - #19385

Merged
javenciu merged 1 commit into
kirodotdev:mainfrom
javenciu:fix/owner-manifest-blob-ssh-agent
Oct 12, 2026
Merged

javenciu merged 1 commit into
kirodotdev:mainfrom
javenciu:fix/owner-manifest-blob-ssh-agent

Conversation

@javenciu

@javenciu javenciu commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: on a git host that only takes agent-held SSH keys, a same-repo app's manifest, icon and screenshots load, because the owner's manifest fetch, blob clone and art prewarm clone keep the ssh-agent socket the way the owner's other clones do.

#18929 made the owner's registry index clone and the owner-designated install clone ask wrap_argv to keep SSH_AUTH_SOCK. minimal_env() carries the socket into the child's environment, and the sandbox wrap removes it unless the spawn asks to keep it (wrap_argv_async adds the option only when it is set). Three other spawns run in the same owner posture (minimal_env() + _context_clone_sandbox_mode, each audited with a _sel_credential_grant) and still do not ask:

  • the owner-designated manifest fetch, _fetch_app_manifest (apps/registry_pipeline/manifests.py:167-169 at 098df01, with its pinned fetch at :189 and plain clone at :243);
  • the owner branch of the blob proxy, _fetch_git_blob (apps/routes.py:3832-3845 at 098df01, clone at :3893);
  • the owner-tier store-art prewarm, _fetch_owner_tier_store_assets (apps/registry_pipeline/store_art.py:1121-1133 at 098df01), which clones through _git_fetch_branch, a function with no parameter for the socket.

On a host where a clone cannot authenticate without the agent, each of these runs fails: the manifest fetch returns None, the blob clone returns False, and the prewarm records a clone failure for the row. #18940 names the first two ("a same-repo app's manifest and art may therefore still fail to load after #18929").

Why it matters

After #18929 an operator's registry on an SSH-only forge indexes and installs, but the store lists that registry's apps without their manifest data, icon or screenshots, and the prewarm that fills the art cache fails on every refresh. The install path reads the manifest through the same fetch before it clones (apps/registry_pipeline/install.py:1771-1779), and when that returns None the admission and platform checks run with no manifest (apps/registry_pipeline/install.py:1784). Hosts reached over HTTPS, and hosts where the agent is not the only way in, are not affected.

Not a goal

  • The anonymous branches stay as they are: an index-originated manifest fetch or blob clone keeps anonymous_git_env() + strict and never asks for the socket (the tests below pin the default case next to the owner case).
  • The credentialed branches (_git_fetch_branch with a credential_target) are untouched. _git_fetch_ref allows a credential target only for HTTP(S), which never uses the agent, and fix(apps): let an owner's SSH registry clone reach the ssh agent #18929 leaves the same branches alone.
  • No change to sandbox.py or to the SSH_AUTH_SOCK consent: wrap_argv still re-judges the request against the tier it applies, and a tier or mask that hides ~/.ssh still needs the consent leaf.
  • The trust gates (is_clone_host_trusted, the SEL credential grants) are unchanged.

What changed (motivation → approach → change)

  • Symptom: on an agent-only SSH host the owner's manifest fetch, blob clone and art prewarm clone fail while the index clone and the install clone succeed.
  • Root cause: the request for the socket is a keyword on the sandbox wrap, set at each owner spawn separately. fix(apps): let an owner's SSH registry clone reach the ssh agent #18929 set it at the index clone and the install clone; these three spawns were not changed, and _git_fetch_branch could not carry it.
  • Change (source: +27 −6 in four files, no new helper):
    • _fetch_app_manifest (apps/registry_pipeline/manifests.py:203,253): the pinned _git_fetch_commit and the plain clone pass forward_ssh_auth_sock=owner_designated. The pinned fetch asks whether or not the URL carries an HTTP credential, as the install's pinned fetch does (apps/registry_pipeline/checkout.py:1087). The default call passes False, which wrap_argv_async drops, so an index-originated fetch makes the same calls it made before.
    • _fetch_git_blob (apps/routes.py:3896): the blob proxy's plain clone passes forward_ssh_auth_sock=owner_designated.
    • _git_fetch_branch (apps/registry_pipeline/checkout.py:682-712): takes forward_ssh_auth_sock and hands it to _git_fetch_ref, as _git_fetch_commit does since fix(apps): let an owner's SSH registry clone reach the ssh agent #18929. _git_fetch_ref already limits it to the network step (apps/registry_pipeline/checkout.py:447).
    • _fetch_owner_tier_store_assets (apps/registry_pipeline/store_art.py:1143): the prewarm passes True. It clones only for an owner-tier registry (TestTrustBoundary::test_an_index_tier_registry_never_clones), the same tier whose install clone asks since fix(apps): let an owner's SSH registry clone reach the ssh agent #18929.
    • Spec: docs/system-specs/modules/security.md (the SSH_AUTH_SOCK forward paragraph now lists the five owner-chosen spawns and the credentialed-branch exception; the same-repo carve-out bullet names the socket) and docs/system-specs/modules/app-kit-platform.md (the prewarm paragraph).
  • Why three sites: the issue names two. The prewarm shares their posture and their failure, is the second producer of the same art, and needs the same one-keyword change, so leaving it would leave one owner spawn on an agent-only host unable to authenticate.

Backwards compatibility

Compatible: nothing that works today stops working. An owner clone that authenticates without the agent still does, and the request only keeps SSH_AUTH_SOCK where wrap_argv already keeps it for the owner's other clones, on tiers where the child can already read the key files.
Removes nothing: _git_fetch_branch gains an optional keyword whose default is the old behaviour; no key, function or branch is removed or narrowed.

Tests

Red on unchanged origin/main 098df01 (the three changed test files copied into a detached checkout of it), pytest test/test_external_registry.py test/test_apps_routes_coverage.py test/test_registry_store_art_prewarm.py -k asks_for_the_agent_socket -p no:cacheprovider -n 0 --no-cov: RC=1 in 3 of 3 runs, 6 failed, 3 passed, 644 deselected. Green on this branch (head a8740d8 on 098df01), the same three files in full: RC=0 in 3 of 3 runs, 653 passed.

The 3 that pass on main are the default cases (manifest branch and pinned, blob), which pin that an index-originated fetch does not ask; the two _git_fetch_branch cases fail with a TypeError because main's function has no such parameter.

FAILED test/test_external_registry.py::test_manifest_fetch_asks_for_the_agent_socket_only_for_the_owners_url[owner-branch] - assert [False] == [True]
FAILED test/test_external_registry.py::test_manifest_fetch_asks_for_the_agent_socket_only_for_the_owners_url[owner-pinned-commit] - assert [False] == [True]
FAILED test/test_external_registry.py::test_branch_fetch_asks_for_the_agent_socket_only_when_told_to[default] - TypeError: _git_fetch_branch() got an unexpected keyword argument 'forward_...
FAILED test/test_external_registry.py::test_branch_fetch_asks_for_the_agent_socket_only_when_told_to[forwarded] - TypeError: _git_fetch_branch() got an unexpected keyword argument 'forward_...
FAILED test/test_apps_routes_coverage.py::TestFetchGitBlobCredentialPosture::test_blob_clone_asks_for_the_agent_socket_only_for_the_owners_url[owner] - assert False is True
FAILED test/test_registry_store_art_prewarm.py::TestOwnerTierPrewarm::test_the_clone_asks_for_the_agent_socket - assert False is True
============ 6 failed, 3 passed, 644 deselected, 1 warning in 5.25s ============

New cases, each driving the production function with the spawn faked and asserting the keyword the sandbox wrap receives (and, for the fetches, that init and remote setup never get it):

  • test_external_registry.py::test_manifest_fetch_asks_for_the_agent_socket_only_for_the_owners_url: {default, owner} × {branch, pinned-commit}, on the _ssh_capture helper fix(apps): let an owner's SSH registry clone reach the ssh agent #18929 added.
  • test_external_registry.py::test_branch_fetch_asks_for_the_agent_socket_only_when_told_to: {default, forwarded}.
  • test_apps_routes_coverage.py::TestFetchGitBlobCredentialPosture::test_blob_clone_asks_for_the_agent_socket_only_for_the_owners_url: {default, owner}.
  • test_registry_store_art_prewarm.py::TestOwnerTierPrewarm::test_the_clone_asks_for_the_agent_socket.

One mutation per rule, each failing exactly its own case and no other: the manifest plain clone, the manifest pinned fetch, the blob clone, the _git_fetch_branch pass-through or the prewarm dropping the request fails [owner-branch], [owner-pinned-commit], the blob [owner] case, [forwarded] or the prewarm test; making the default manifest clone, manifest pinned fetch or blob clone ask fails [default-branch], [default-pinned-commit] or the blob [default] case. Five existing wrap_argv fakes (four in test_apps_routes_coverage.py, one in test_apps_registry_coverage.py) now accept **kwargs, because the owner path passes the new keyword; no assertion in an existing test changed. No port, sleep or real child process is used.

The 17 files that name the changed functions or exercise the registry install and blob routes: 1702 passed, 5 skipped. test_sandbox_ssh_auth_sock_forward.py, which covers what wrap_argv does with the request: 31 passed. test_flake_pattern_ratchet.py: 53 passed. mypy on the four source files, flake8, isort, black on the files outside the baseline, scripts/check_black_formatting.py, COMMENT_HISTORY_BASE_REF=origin/main scripts/check_comment_history.py, scripts/check_subprocess_encoding.py, scripts/check_brand_name.py, scripts/docs-lint.sh, check_acp_frame_host_data, check_agent_sdk_boundary, check_sync_io_in_async and check_lockdown_before_publish exit 0.

Manual verification

None beyond the tests: there was no run against an agent-only SSH host. Each test pins the request the spawn makes; what wrap_argv does with the request is unchanged.

Related Issues

Fixes #18940. Follows #18929 (merged).

Open #18621, #18004 and #16517 edit files this change edits, but they conflict with origin/main already: git merge-tree against this head lists the same conflicting files as against origin/main. #19285, #19281, #17015 and #15661 merge cleanly with this head.

Pattern harvest

Rule candidate: review-prompt. A spawn in the owner posture (minimal_env() + _context_clone_sandbox_mode() + a _sel_credential_grant) states its socket request in the same call as the posture, so the halves of the posture cannot drift apart. grep -n "_sel_credential_grant(" under src/kiro_crew/apps lists every such spawn.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners October 12, 2026 10:48
@javenciu
javenciu requested a review from CrysisDeu October 12, 2026 10:48
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision f78787c7f27b5a04f736ce051d8d377649434bc8 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of f78787c7f27b5a04f736ce051d8d377649434bc8 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that every path into _fetch_owner_tier_store_assets is owner-tier, because the prewarm passes forward_ssh_auth_sock=True unconditionally instead of tracking a provenance flag.

What this change ships

Inventory (5 items) — 5 justified

Intent: on an SSH-agent-only forge, a same-repo registry app's manifest, icon and screenshots load in the store. This is a FIX for #18940's leftover after #18929.

  1. The owner-designated manifest fetch (pinned fetch and plain clone) keeps the ssh-agent socket, so the manifest loads. — justified
  2. The blob proxy's owner branch keeps the socket, so icons and screenshots render. — justified
  3. The owner-tier store-art prewarm clone keeps the socket, so the art cache fills on refresh. — justified
  4. _git_fetch_branch gains an optional forward_ssh_auth_sock keyword (default off) and passes it to _git_fetch_ref. It has one consumer, the prewarm, mirroring _git_fetch_commit. — justified
  5. The specs in security.md and app-kit-platform.md now list five owner spawns that ask for the socket, plus the credentialed-branch exception. — justified

[FIRST-PRINCIPLES-REVIEWED] f78787c

Description read

[DESCRIPTION-READ] d03bb670b7f957b9112dfa8284245ac001d9a15350a57f2f4f23cc31ba33b600

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of f78787c7f27b5a04f736ce051d8d377649434bc8 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check one thing: the owner-tier prewarm passes forward_ssh_auth_sock=True every time, so it now offers the operator's agent keys to clones of index-listed sibling URLs during browsing, with no install click.

[DESIGN-REVIEWED] f78787c

Description read

[DESCRIPTION-READ] 5b15482fcab4b6bfdb04e20d0286d7e16eb4730f0588c689f7383b31786ea19f

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed f78787c7f27b5a04f736ce051d8d377649434bc8 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] f78787c

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed f78787c7f27b5a04f736ce051d8d377649434bc8 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f78787c

The owner's registry index clone and install clone ask wrap_argv to
keep the ssh-agent socket, so they authenticate on a host whose git
server takes only agent-held keys. Three other spawns run in the same
owner posture (minimal_env plus the context sandbox mode) and did not
ask: the same-repo manifest fetch, the blob proxy's owner branch and
the owner-tier store-art prewarm. On such a host their clone failed
without the socket, so a same-repo app's manifest and art did not load.

Each now passes the owner's decision as the socket request:
owner_designated for the manifest fetch (plain clone and pinned fetch)
and for the blob clone, True for the prewarm, whose rows are owner-tier.
_git_fetch_branch gains the forward_ssh_auth_sock pass-through that
_git_fetch_commit already has. wrap_argv still re-judges the request
against the tier, and the anonymous branches do not ask.

Fixes kirodotdev#18940
@javenciu
javenciu force-pushed the fix/owner-manifest-blob-ssh-agent branch from a8740d8 to f78787c Compare October 12, 2026 20:04
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 12, 2026
@javenciu
javenciu enabled auto-merge (squash) October 12, 2026 23:04

@iamwhatever iamwhatever left a comment

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.

This PR finishes #18929. The three remaining owner-posture git spawns now ask wrap_argv to keep SSH_AUTH_SOCK: the owner-designated manifest fetch (manifests.py, pinned and plain clone), the owner branch of the blob proxy (routes.py _fetch_git_blob), and the owner-tier store-art prewarm (store_art.py through a new _git_fetch_branch pass-through). This fixes the root cause of manifest, icon and screenshot loads failing on agent-only SSH forges. I tried to get the socket into an anonymous spawn: every new request is gated on owner_designated (the byte-identical-URL carve-out), so the default index-originated path passes False and wrap_argv_async drops it. The prewarm's unconditional True runs only after its own transport allowlist, branch, subdir and is_clone_host_trusted gates and the SEL grant, the same treatment install gives an _owner_tier_confirmed entry (install.py:1748 sets index_originated=False, so forward_sock=True at checkout.py:774). So the agent is never offered to a URL that did not already get the owner's minimal_env identity. _git_fetch_ref still limits the socket to the network step, and wrap_argv still re-judges it against the tier and the consent leaf. The tests check the kwarg in both the default and owner cases, plus the network-only rule, at every site, and both AI lanes pass, checks are green and the branch is mergeable. — crew-pr-reviewer (deep re-check)

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

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Owner manifest fetch and blob proxy still drop the ssh-agent socket

2 participants