Description
Describe the bug
On Apple Silicon, gh extension install / upgrade always re-signs a downloaded darwin-arm64 extension binary ad-hoc, even when the binary is already validly signed with a Developer ID (pkg/cmd/extension/manager.go, codesignBinary):
codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime <binPath>Because requirements is preserved, the installed binary keeps the Developer ID designated requirement but now carries an ad-hoc signature, so it no longer satisfies its own designated requirement:
$ codesign -d -r- ~/.local/share/gh/extensions/gh-sk/gh-sk
designated => identifier "io.github.kezhenxu94.gh-sk" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "58JAK95Y3A"
$ codesign --verify --strict --verbose=2 ~/.local/share/gh/extensions/gh-sk/gh-sk
.../gh-sk: valid on disk
.../gh-sk: does not satisfy its designated Requirement
This breaks anything that relies on code identity. For example, an extension that reads the macOS Keychain: "Always Allow" records the designated requirement, which the binary can never satisfy, so macOS prompts for the login password on every keychain read. It also makes it impossible for extension authors to ship a stable signing identity across releases (the reason to sign with a Developer ID in the first place).
Affected version
gh version 2.95.0 (2026-06-17)
Steps to reproduce the behavior
- Publish a
darwin-arm64release asset signed with a Developer ID (codesign --sign "Developer ID Application: …" --identifier <id> --timestamp --options runtime).codesign --verify --strictpasses on the asset. - On an Apple Silicon Mac:
gh extension install <owner>/<repo>. codesign --verify --strict --verbose=2 ~/.local/share/gh/extensions/<name>/<name>reportsdoes not satisfy its designated Requirement, andcodesign -dvshowsSignature=adhoc.
Example: https://github.com/kezhenxu94/gh-sk/releases/tag/v0.4.1 (both assets verify as Developer ID, team 58JAK95Y3A, before install).
Expected vs actual behavior
Expected: a binary that already has a valid signature (codesign --verify --strict succeeds) is installed unchanged; ad-hoc signing is only applied to unsigned binaries, which is what it is needed for.
Actual: every darwin-arm64 binary is re-signed ad-hoc while keeping its old requirements, leaving validly signed binaries with an unsatisfiable designated requirement.
A possible fix: in codesignBinary, skip re-signing when codesign --verify --strict <binPath> succeeds (or at least drop requirements from --preserve-metadata so the result is self-consistent).
Logs
N/A (no error is reported; the problem is the resulting signature).
Activity
cli-triage commentedon Nov 9, 2026
Unable to test: macOS code signing is unavailable in the tested Linux builds.
Using test data, the download and install path completed on 2.95.0, 2.103.3, and source:
$ gh extension install example.invalid/gh-signed --forceOutput: none. Exit status:
0.The macOS-only signing step could not run, so this does not verify signature damage. Current source still ad-hoc signs every selected
darwin-arm64asset with--forcewhile preserving requirements, without checking its existing signature. This supports bug classification, but a macOS run with a Developer ID asset is needed to confirm the full symptom.Supporting reports
Duplicate analysis
Label reasoning
Reproduction log
Investigation notes
Generated by issue triage.