Skip to content

extension install: ad-hoc re-signing of darwin-arm64 binaries breaks Developer ID signed extensions #14949

Open

Description

@kezhenxu94

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

  1. Publish a darwin-arm64 release asset signed with a Developer ID (codesign --sign "Developer ID Application: …" --identifier <id> --timestamp --options runtime). codesign --verify --strict passes on the asset.
  2. On an Apple Silicon Mac: gh extension install <owner>/<repo>.
  3. codesign --verify --strict --verbose=2 ~/.local/share/gh/extensions/<name>/<name> reports does not satisfy its designated Requirement, and codesign -dv shows Signature=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

  1. added
    needs-triage
    on Nov 5, 2026
  2. cli-triage commented on Nov 9, 2026

    @cli-triage

    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 --force

    Output: 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-arm64 asset with --force while 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

    Generated by issue triage.

  3. deleted a comment from cli-triage on Nov 9, 2026
  4. added
    bug
    gh-extension
    priority-3
    on Nov 9, 2026
  5. removed
    needs-triage
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggh-extensionpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions