Skip to content

fix(git-auth): refuse non-GitHub hosts in the App credential helper#114

Merged
NimbleCoAI merged 1 commit into
mainfrom
dev/juniperbevensee/helper-host-allowlist
Jul 23, 2026
Merged

fix(git-auth): refuse non-GitHub hosts in the App credential helper#114
NimbleCoAI merged 1 commit into
mainfrom
dev/juniperbevensee/helper-host-allowlist

Conversation

@NimbleCoAI

Copy link
Copy Markdown
Collaborator

Closes the gap our own upstream audit found in our deployed helper (fleet lessons 2026-07-23, item 6): hermes_cli/github_app_token.py answered every credential request without checking the host= field, relying solely on the boot-written scoped gitconfig.

What

Port of the host-allowlist shipped in our upstream contribution (NousResearch/hermes-agent#69972, commit 99fe8c7):

  • get-credential now parses git's stdin credential description block
  • Answers only for github.com / gist.github.com over https
  • Anything else: emit nothing, exit 0 → git falls through to the next helper; the token never travels toward an unrecognized host
  • Empty request (no stdin — manual smoke test) still answers, so existing invocations are unaffected

Why

git invokes credential helpers for EVERY https remote. A malicious submodule or redirect pointing at an attacker host would previously have been handed the org installation token if the helper were ever wired unscoped. Defense in depth: the scoped gitconfig remains, and the helper now enforces the same boundary itself.

Tests

  • 5 new tests: foreign host refused, non-https refused, both allowed hosts answered, empty-request back-compat
  • tests/hermes_cli/test_github_app_token.py 22/22 pass; test_git_credentials_boot.py + test_gh_token_inject.py 41/41 pass; ruff clean

🤖 Generated with Claude Code

Port of the host-allowlist our upstream contribution ships
(NousResearch/hermes-agent#69972, commit 99fe8c7): git invokes
credential helpers for EVERY https remote, so a helper that ignores the
request's host= field hands the installation token to any URL a repo,
submodule, or redirect points at. The boot-written gitconfig already
scopes the helper to https://github.com; this enforces the same
boundary inside the helper itself.

get-credential now parses git's stdin description block and answers
only for github.com / gist.github.com over https — anything else emits
nothing and exits 0 so git falls through to the next helper. An empty
request (manual smoke test) still answers, so existing invocations are
unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NimbleCoAI
NimbleCoAI merged commit 62647e1 into main Jul 23, 2026
32 checks passed
@NimbleCoAI
NimbleCoAI deleted the dev/juniperbevensee/helper-host-allowlist branch July 23, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants