You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Decision: gh active account versus the host's ssh identity before setup-github registers a key #4483
When gh's active account differs from the account the host's existing ssh identity answers as, what should setup-github --configure do before registering a key through gh?
Concretely: the host's existing ssh identity answers as account P, gh is logged in with active account W, and the managed key is freshly generated, so it is registered nowhere. The gate added for #2552 proves the managed key is on no other account. It does not prove that W is the account the operator intends, and gh supports several accounts. Today both registrations are written to W, and the script warns about the mismatch only afterwards.
Options
Recommended: refuse the gh registration and fall back to the paste, naming both accounts. It fails closed, like the rest of the gate. The operator then registers the key on the intended account in a browser, or logs gh in as that account and re-runs. This is a small edit to the gate in host-setup/linux/setup-github.sh and host-setup/windows/setup-github.ps1, using the general greeting that github_auth_user already returns, plus tests on both platforms.
Register on gh's active account, but warn and name both accounts before writing. It is less strict, and the warning gives the operator a chance to interrupt. It is the same small edit to the gate, with tests, but the warning carries the protection and an unattended run writes anyway.
Register on gh's active account as now, and only document it. No code change. The write can still land on the wrong account, and the operator learns it afterwards.
What each option does to the parked work
Options 1 and 2 are small edits in the gate, with tests. The branch's other four pass-6 findings are independent of the choice.
Option 3 needs no code. The PR then only needs those four fixes and a documentation sentence.
When gh's active account differs from the account the host's existing ssh identity answers as, what should setup-github --configure do before it registers the managed key through gh? Draft #4482 adds gh ssh-key add registration where gh is already logged in with the key scopes, per your 2026-11-01 answer on #2552. Its gate already refuses the gh write when the managed key answers as another account, and when the probe cannot tell. It does not check the case where the host's general ssh greeting names account P while gh is active as account W. The managed key is new, so it is registered nowhere, and both registrations go to W. The script warns about the mismatch only after writing. Which account a host is meant for is your call, so the group parked rather than guessing.
Options:
Refuse the gh registration and fall back to the paste, naming both accounts (recommended). Where the general greeting names an account and it differs from gh's, the gate stops before any write and prints both names. The operator registers the key in a browser on the intended account, or logs gh in as that account and re-runs. It matches the gate's two existing refusals, which also fail closed to the paste. A host with no existing ssh identity is unaffected. It is a small edit in host-setup/linux/setup-github.sh and host-setup/windows/setup-github.ps1, reusing the greeting github_auth_user already returns, plus a test on each platform. Register the Managed SSH Key Through a Logged-In gh in setup-github #4482 then takes this edit with its four other pass-6 fixes and leaves draft.
Ask on a terminal, refuse without one.--configure may already prompt, for a key passphrase. With a terminal attached, the script names both accounts and asks whether to register on W. Without one it refuses as in option 1. It keeps the one-step path for an operator who meant W, at the cost of a prompt path and its tests on both platforms.
Warn and name both accounts before writing, then register on W. The same small edit, but the warning is the only protection. An unattended or inattentive run still writes to the wrong account, and removing a key from the wrong account is a manual step afterwards.
Evidence:#4483 body. #4482 body, finding 2, and its gate in register_keys_through_gh, which refuses on MANAGED_USER differing from gh's account or on an unproven probe. #2552 maintainer answer, 2026-11-01: script gh ssh-key add where gh is logged in, keep gh auth login interactive, and verify on a fresh host. #4482 is draft and parked behind this issue.
Maintainer's answer, 2026-11-26 triage: option 1. When gh's active account differs from the account the host's ssh identity answers as, setup-github --configure refuses to register through gh, names both accounts, and falls back to the paste path. Tests cover it on both platforms. #4482 can resume.
Activity
ptr727 commentedon Nov 26, 2026
Triage question, 2026-11-26.
When
gh's active account differs from the account the host's existing ssh identity answers as, what shouldsetup-github --configuredo before it registers the managed key throughgh? Draft #4482 addsgh ssh-key addregistration whereghis already logged in with the key scopes, per your 2026-11-01 answer on #2552. Its gate already refuses theghwrite when the managed key answers as another account, and when the probe cannot tell. It does not check the case where the host's general ssh greeting names account P whileghis active as account W. The managed key is new, so it is registered nowhere, and both registrations go to W. The script warns about the mismatch only after writing. Which account a host is meant for is your call, so the group parked rather than guessing.Options:
ghregistration and fall back to the paste, naming both accounts (recommended). Where the general greeting names an account and it differs fromgh's, the gate stops before any write and prints both names. The operator registers the key in a browser on the intended account, or logsghin as that account and re-runs. It matches the gate's two existing refusals, which also fail closed to the paste. A host with no existing ssh identity is unaffected. It is a small edit inhost-setup/linux/setup-github.shandhost-setup/windows/setup-github.ps1, reusing the greetinggithub_auth_useralready returns, plus a test on each platform. Register the Managed SSH Key Through a Logged-In gh in setup-github #4482 then takes this edit with its four other pass-6 fixes and leaves draft.--configuremay already prompt, for a key passphrase. With a terminal attached, the script names both accounts and asks whether to register on W. Without one it refuses as in option 1. It keeps the one-step path for an operator who meant W, at the cost of a prompt path and its tests on both platforms.Evidence: #4483 body. #4482 body, finding 2, and its gate in
register_keys_through_gh, which refuses onMANAGED_USERdiffering fromgh's account or on an unproven probe. #2552 maintainer answer, 2026-11-01: scriptgh ssh-key addwhereghis logged in, keepgh auth logininteractive, and verify on a fresh host. #4482 is draft and parked behind this issue.ptr727 commentedon Nov 26, 2026
Maintainer's answer, 2026-11-26 triage: option 1. When gh's active account differs from the account the host's ssh identity answers as,
setup-github --configurerefuses to register through gh, names both accounts, and falls back to the paste path. Tests cover it on both platforms. #4482 can resume.Refuse the gh Registration Where the Host's ssh Identity Answers as A…
Register the Managed SSH Key Through a Logged-In gh in setup-github (#…