feat(scan): attach the developer's SSH keys for private module fetches - #194
Merged
Conversation
The parser is moving to an in-process getter (grabber) whose SSH system fallback only consults the ssh-agent, so a key sitting in ~/.ssh that isn't loaded into an agent would stop working for private git-over-ssh modules. Read the developer's on-disk keys and pass them as typed FetchAuth on GenericOptions so they authenticate explicitly. - Scan the standard ~/.ssh default key files, or an explicit list from the --ssh-key-file flag / INFRACOST_CLI_SSH_KEY_FILE env. Passphrase- protected and unreadable keys are skipped (the agent covers those). - Keys travel with an empty host (offered as defaults for any host); grabber still falls back to the agent, so this never suppresses agent identities. - Wired on every fetch-capable command (scan, price, policies) and the MCP scan/price tools via cfg. HTTPS creds, known_hosts and the agent stay covered by grabber's system fallback, so only SSH keys are set. Requires the proto FetchAuth options (proto pin bumped here).
liamcervante
force-pushed
the
feat/fetch-auth-options
branch
from
July 24, 2026 12:27
6c928c3 to
d9665c3
Compare
liamcervante
marked this pull request as ready for review
July 24, 2026 15:18
liamg
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepares the CLI for the parser's move to an in-process getter (grabber). grabber's SSH system fallback only consults the ssh-agent, so a developer whose key lives in
~/.sshbut isn't loaded into an agent would lose access to private git-over-ssh modules. This reads those on-disk keys and passes them explicitly asFetchAuthonGenericOptions.SSH keys are the only thing the CLI needs to set — HTTPS credentials (keychain /
store/ netrc viagit credential fill),~/.ssh/known_hostsverification, and the agent are all still covered by grabber's system fallback on a dev machine.Changes
internal/scanner.ResolveSSHFetchAuthbuildsFetchAuth.ssh_keysfrom either an explicit list (--ssh-key-file/INFRACOST_CLI_SSH_KEY_FILE, comma-separated) or, when unset, the standard~/.sshdefault key files (id_rsa,id_ecdsa,id_ed25519, …). Passphrase-protected and unreadable keys are skipped with a warning/debug log — they remain resolvable via the agent.scan,price,policies— and the MCPscan/pricetools (viacfg). The--ssh-key-fileflag is registered onscanandprice(mirroring--currency); the env var flows to all of them throughcfg.Notes
FetchAuthoptions — pinned to the proto branch commit here; repin to the tag once feat(options): add FetchAuth and GIT_HTTP credentials for remote fetching proto#88 merges.FetchAuth.ssh_keyslands with the grabber migration; the field is additive and ignored until then.Checklist