Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(hogli): handle key:: prefix in user.signingkey (#58159)

Phil Haackc56850985eb2
diff --git a/tools/hogli-commands/hogli_commands/devbox/cli.py b/tools/hogli-commands/hogli_commands/devbox/cli.py
index 2bf0988009ed..b55e4aa4746d 100644
--- a/tools/hogli-commands/hogli_commands/devbox/cli.py
+++ b/tools/hogli-commands/hogli_commands/devbox/cli.py
@@ -353,8 +353,9 @@ def _resolve_local_identity_agent_for_coder() -> str | None:
def _resolve_local_signing_key() -> str | None:
"""Return the engineer's ``git config user.signingkey``, normalized to a literal SSH public key string.
- Git accepts two formats: a literal ``ssh-... / ecdsa-... / sk-...`` string
- or a path to a public-key file. Both are normalized here. Returns ``None``
+ Git accepts three formats: a literal ``ssh-... / ecdsa-... / sk-...``
+ string, the same with a ``key::`` prefix (used by tools like Secretive),
+ or a path to a public-key file. All are normalized here. Returns ``None``
when the value is unset or the referenced file can't be read.
"""
result = subprocess.run(
@@ -367,6 +368,8 @@ def _resolve_local_signing_key() -> str | None:
value = result.stdout.strip()
if not value:
return None
+ if value.startswith("key::"):
+ value = value.removeprefix("key::")
if value.startswith(("ssh-", "ecdsa-", "sk-")):
return value
try:
diff --git a/tools/hogli-commands/hogli_commands/tests/test_devbox.py b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
index 0ae93441340b..7678f62c46f9 100644
--- a/tools/hogli-commands/hogli_commands/tests/test_devbox.py
+++ b/tools/hogli-commands/hogli_commands/tests/test_devbox.py
@@ -1587,6 +1587,16 @@ class TestResolveLocalSigningKey:
)
assert devbox_cli._resolve_local_signing_key() == "ssh-ed25519 AAAA user@host"
+ def test_strips_key_prefix(self, monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.setattr(
+ devbox_cli.subprocess,
+ "run",
+ lambda *a, **kw: subprocess.CompletedProcess(
+ a[0], 0, "key::ecdsa-sha2-nistp256 AAAA GitHub-Commit-Signing@host\n", ""
+ ),
+ )
+ assert devbox_cli._resolve_local_signing_key() == "ecdsa-sha2-nistp256 AAAA GitHub-Commit-Signing@host"
+
def test_reads_file_when_value_is_path(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
key_file = tmp_path / "id_ed25519.pub"
key_file.write_text("ssh-ed25519 AAAAFROMFILE user@host\n")