Skip to content

repo-fleet-hygiene:audit: every ls-remote probe fails because run_git_probe discards global core.sshCommand, so merged-remote-branch never reaches HIGH #4211

Closed

Description

@kyle-sexton

Problem

In a 20-repository audit on Windows, all 20 merged-remote-branch findings came back MEDIUM with "current remote existence could not be verified (ls-remote failed)". Running git ls-remote by hand with the same arguments worked: 18 heads were already gone upstream and 2 were live at the matched tip. So the audit reported 18 false findings and missed 2 HIGH ones.

Cause

run_git_probe (skills/audit/scripts/audit-fleet.sh, ~line 259) exports GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null. That also discards transport settings that ls-remote needs:

  • global core.sshCommand = C:/Windows/System32/OpenSSH/ssh.exe. Without it, Git for Windows uses its bundled ssh, which cannot reach the Windows OpenSSH agent.
  • system credential.helper = manager for HTTPS remotes.

Reproduction on an ssh://[email protected]/... remote:

GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null GIT_TERMINAL_PROMPT=0 git ls-remote --heads origin refs/heads/main
# Please make sure you have the correct access rights and the repository exists.

Fix options

  • Run the ls-remote probe through a separate wrapper that keeps global and system config. Pin only url.*.insteadOf / pushInsteadOf (or check that the resolved URL still normalizes to the same github.com identity), and keep GIT_TERMINAL_PROMPT=0.
  • Or pass only the needed transport keys through (core.sshCommand, credential.helper) with -c.

Also: when every ls-remote in a run fails, emit one fleet-level UNKNOWN finding. That signal is more useful than N repeated MEDIUM findings.

Observed in repo-fleet-hygiene 0.23.29, Windows 11, Git Bash, SSH remotes.

Activity

  1. added
    needs-triage
    on Sep 19, 2026
  2. added
    agent-ready
    status: ready
    and removed
    needs-triage
    on Sep 23, 2026
  3. kyle-sexton commented on Sep 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Decision defaulted: give ls-remote a narrow wrapper that keeps core.sshCommand/credential.helper via explicit -c passthrough rather than restoring full global/system config (preserves the includeIf-redirect hardening the /dev/null pin exists for); also add the one fleet-level UNKNOWN when every probe fails — veto before merge

  4. added theissue type on Sep 23, 2026
  5. kyle-sexton commented on Sep 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Agent Brief

    Type: Bug
    Summary: Give the remote-branch-existence probe (ls-remote) a transport-preserving path so it can actually reach SSH and HTTPS remotes, instead of losing the operator's SSH-command override and credential helper.

    Current behavior:
    Every git probe the fleet audit runs, including the ls-remote check used to confirm whether a merged pull request's remote branch still exists, is executed with the global and system git configuration both pinned to a null path. This isolation is deliberate for probes that read repository state (it stops an injected global config redirect from steering a probe away from the repository's own on-disk config), but it also discards global and system transport settings such as a configured SSH command override and a configured credential helper. When those settings are required to reach the remote, every ls-remote invocation in the run fails, and every affected finding is reported as an unverifiable medium-confidence finding instead of a confirmed high-confidence finding or being cleared entirely.

    Desired behavior:
    Defaulted decision: give the ls-remote probe a narrow wrapper that keeps the needed transport settings (an SSH command override and a credential helper) via explicit passthrough, rather than restoring the full global and system git configuration for that probe. This preserves the isolation hardening the null-config pin exists for everywhere else. Maintainer-vetoable alternative: run the ls-remote probe through a separate wrapper that restores the full global and system git configuration, while still pinning the specific redirect-capable settings (URL rewrite rules) to neutral values, or verifying the resolved remote URL still normalizes to the same host identity, so the probe can use whatever transport configuration the operator has set up without hand-picking individual settings.

    Under the defaulted approach: the ls-remote probe must be able to read the invoking user's configured SSH command override and credential helper without also inheriting a redirect-capable global config setting. Terminal prompting must remain disabled so a missing credential never blocks the run on an interactive prompt. Additionally, when every ls-remote invocation in a run fails outright (as opposed to succeeding with an empty result), the audit must emit one fleet-level unknown-confidence finding stating that remote-branch verification could not be performed for the run, rather than repeating the same per-repository medium-confidence finding once for every affected branch.

    Key interfaces:

    • The git-probe execution path used specifically by the remote-branch-existence check must diverge from the general read-only probe path: it needs access to an SSH command override and a credential helper (or their moral equivalent) while every other probe keeps the null-config isolation.
    • A new fleet-level finding kind (or reuse of an existing unknown-confidence, non-actionable kind) for "remote verification unavailable for this run," emitted once per run, not once per repository, when every ls-remote call in the run fails.

    Acceptance criteria:

    • With a global SSH command override configured and no other change, running the fleet audit against a repository whose merged-branch remote-existence check requires SSH produces a confirmed (not unverifiable) verdict for that finding.
    • With a system-level credential helper configured, the same holds for an HTTPS remote.
    • The general read-only git probes used elsewhere in the audit (branch inventory, current-branch checks, etc.) are unaffected: a case where an injected global config redirect exists still has no effect on those probes' results.
    • When every ls-remote call in a run fails (for example, no network reachability to the remote host), the report contains exactly one fleet-level unknown-confidence finding about remote verification, not one per affected repository or branch.
    • Terminal prompting stays disabled for the ls-remote probe; a missing credential does not hang the run on a prompt.

    Out of scope:

  6. 4 remaining items

  7. added
    needs-human
    needs-owner-decision
    and removed
    status: ready
    agent-ready
    on Sep 29, 2026
  8. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    From the 2026-09-29 audit of the unattended Cursor run.

    Reopened: acceptance criterion 4 is unmet on main. AC4 says an all-fail run produces "exactly one fleet-level unknown finding, not one per affected repository". On main (audit-fleet.sh:3108-3115) the run emits the fleet-level ls-remote-fleet-unavailable row and still keeps N per-repository MEDIUM merged-remote-branch rows; the PR #4905 body says "The per-repository MEDIUM findings stay". The triage text "Decision defaulted ... veto before merge" is AI text, not an owner decision, so both questions below are open. Added needs-human and status: needs-decision.

    Q1, transport for ls-remote.

    • Option A (the triage default): explicit -c core.sshCommand and -c credential.helper passthrough. Smallest trust surface; keeps the includeIf-redirect pin.
    • Option B (what fix(repo-fleet-hygiene): ls-remote probes keep transport config (#4211) #4727 shipped): full global/system config plus a URL-binding check that the remote names the same github.com repository with and without that config (audit-fleet.sh:342-371).
    • No recommendation: this is a security decision and judgment is not enough. The evidence that settles it: whether any fleet host needs transport keys beyond core.sshCommand and credential.helper (http.proxy, GIT_SSH, ssh config includes), and whether the binding check holds against a global url.*.insteadOf.

    Q2, the all-fail rollup.

    No code changes until both are answered; #4895 is not being revived.

  9. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-09-29): Q1 (transport for ls-remote): decide with evidence. The owner delegated gathering the evidence: whether any fleet host needs transport keys beyond core.sshCommand and credential.helper (http.proxy, GIT_SSH, ssh config includes), and whether the binding check at audit-fleet.sh:342-371 holds against a global url.*.insteadOf. Q2 (all-fail rollup): option B, withhold the per-repository MEDIUM merged-remote-branch rows when every ls-remote probe fails, leaving the one fleet-level ls-remote-fleet-unavailable finding.

    Next: an agent posts the Q1 evidence on this issue and stops; Q1 is a security choice, so the final call stays with the owner (needs-human stays). The Q2 change to audit-fleet.sh (withhold the MEDIUM rows on all-fail, satisfying AC4 and keeping the #4220 blocked-verdict interaction) can proceed now. #4895 is not revived.

  10. added
    agent-ready
    and removed
    needs-owner-decision
    on Sep 29, 2026
  11. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Resolution (2026-09-29, owner-approved consensus)

    Q2 (AC4) is already on origin/main: #5369 (34ca8b0) withholds the per-repo MEDIUM ls-remote findings when every probe fails, and audit-fleet.sh emits the single ls-remote-fleet-unavailable row. This comment is the Q1 evidence the owner delegated. Read-only probes only; no config, registry, or credential was changed or printed (key names and set/unset only).

    Per-lane transport table

    Probe: git config --{global,system} --show-origin --name-only --get-regexp '^(core\.sshcommand|credential\.|http\.|url\..*insteadof|include|includeif)', env checks, ssh -G github.com filtered to include|identityagent|proxycommand|proxyjump, ~/.ssh/config Include count, then GIT_TERMINAL_PROMPT=0 git ls-remote {https,git@} ... HEAD with the real config.

    Lane global git keys system git keys GIT_SSH / GIT_SSH_COMMAND / GIT_ASKPASS / *_proxy ssh -G include/identityagent/proxycommand/proxyjump ~/.ssh/config Include ls-remote https / ssh
    melo-desk-001 WSL core.sshCommand, credential.helper (+ per-host helpers), include.path, includeIf none all unset none 0 ok / ok
    melo-desk-001 native Windows (KyleSexton) same set http.sslBackend, credential.helper, credential.https://dev.azure.com.useHttpPath all unset none 0 ok / ok
    melo-lap-001 WSL same set as desk WSL none all unset none 0 ok / ok
    melo-lap-001 native Windows (console account) NOT OBSERVED NOT OBSERVED NOT OBSERVED NOT OBSERVED NOT OBSERVED NOT OBSERVED

    The laptop's Windows lane only answers over port 22 as ssh-admin, which has no ~/.gitconfig, no ~/.ssh, and no GitHub identity (git config --global matched no keys; .ssh empty), so it is not the operator lane. Reading the console account's profile from ssh-admin was refused by the auto-mode classifier as credential exploration, and I did not work around it. The laptop's Windows git setup is mirrored from the same chezmoi source as the desktop's, but that is an inference, not an observation.

    Answer to "is any transport key beyond core.sshCommand and credential.helper needed to reach github.com": on the three observed lanes, no. Nothing sets http.proxy, GIT_SSH, an ssh config Include, ProxyCommand, or ProxyJump. include.path and includeIf are present in every global config, and they are how some of those keys could arrive; the pinned -c passthrough of Option A does not read them. Reaching github.com over ssh needs core.sshCommand: in the scratch run below, with no core.sshCommand, the ssh ls-remote failed rc=128 ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory.

    insteadOf binding test (audit-fleet.sh:342-371, origin/main copy)

    Run in .work/binding-4211/ (gitignored scratch repo under the checkout) with a scratch GIT_CONFIG_GLOBAL file and GIT_CONFIG_SYSTEM=/dev/null; real config untouched. run_ls_remote_probe called with a pinned remote and one global url.<to>.insteadOf <from> rule per row.

    == controls (no rewrite)
    https pinned, no rule                                   rc=0 <sha> refs/heads/main
    ssh pinned, no rule                                     rc=128 ssh_askpass ... (scratch config has no core.sshCommand)
    == redirect to other repo (must reject)
    https pinned -> insteadOf other repo (https)            rc=1
    ssh pinned -> insteadOf other repo (ssh)                rc=1
    == redirect to different host (must reject)
    https pinned -> insteadOf gitlab.com                    rc=1
    == false-reject checks (should accept)
    mixed-case owner/repo, no rule                          rc=0
    https->ssh same repo rewrite                            rc=128 (binding accepted; ssh auth absent in scratch config)
    ssh->https same repo rewrite                            rc=0
    rewrite adds x-access-token@ to the authority           rc=0
    rewrite to same repo, different case                    rc=0
    

    Result: PASS. All three redirects (other repo over https and ssh, other host) are rejected with rc=1, and no same-repository rewrite (case, https/ssh form, userinfo) was falsely rejected. The two rc=128 rows passed the binding check and failed later at ssh authentication because the scratch config has no core.sshCommand, not at the binding.

    Against the acceptance criteria

    • AC4 (per-repo findings withheld when every probe fails): met on origin/main (fix(repo-fleet-hygiene): withhold per-repo MEDIUM ls-remote findings when every probe fails #5369).
    • Option B (shipped): binding test passes on the tested vectors.
    • Option A (narrow -c passthrough of core.sshCommand and credential.helper): the observed lanes need nothing else, so A is viable on those, with one gap: the laptop's Windows console-account lane was not observed, and include.path/includeIf are used everywhere but ignored by A.
    • Q1 (A or B) is a security choice; I am not choosing it.

    Nothing remains to implement in this repo unless the owner picks A. needs-human stays on this issue for that pick. If B (already in main): close as completed. If A: file a follow-up PR replacing the global/system passthrough with the pinned -c keys, and first read the laptop's Windows lane at its console.

  12. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-09-30): Option B. Close as completed on the shipped global/system git config plus URL binding. AC4 was met by #5369 on origin/main, and the fleet probes on melo-desk-001 (WSL and native Windows) and melo-lap-001 (WSL) passed the insteadOf binding test (3 redirect rows rejected, 0 false rejects across 5 same-repo rows). Option A (a narrow -c passthrough) is not taken. The owner: "I explicitly want you to do the recommended stuff here."

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyneeds-human

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions