Skip to content

fix: the HEIC download dialog looping in a signed macOS build - #81

Merged
IAmJSD merged 1 commit into
mainfrom
fix/heic-download-loop-macos
Aug 30, 2026
Merged

IAmJSD merged 1 commit into
mainfrom
fix/heic-download-loop-macos

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Aug 30, 2026

Copy link
Copy Markdown
Member

codesign --options runtime turns on library validation, and a process under it may only dlopen libraries signed by its own Team ID. No copy of libheif is: not Homebrew's, and not the decode-only build the app downloads, which is ad-hoc signed on arm64 and unsigned on x86_64. So in a signed build every candidate is refused, the retry after the install fails exactly like the first attempt did, and the consent dialog opens again -- and again. Unsigned dev builds do not enforce validation, which is why this only appeared once bundled.

The entitlement is the fix. The rest is so that a library that will not load can never again present itself as one that is missing:

download_would_help now says no once the pinned bytes are already on disk. Fetching the same five megabytes over the top cannot change the mind of a loader that has already refused them, so the failure falls through to the status line instead of back into the dialog. Bytes that merely exist do not count -- a hash that does not match the pin is an older managed build, which a download does replace.

And what reaches that status line is now worth reading: libheif() kept only the last candidate's error, so the managed library's rejection was overwritten by the system library's "image not found" and the signature policy never surfaced. Every candidate reports.

The test-skip predicate keeps the old meaning under its own name, no_decoder_available: a machine with no decoder should skip the fixtures whether or not a download would do anything about it.

`codesign --options runtime` turns on library validation, and a
process under it may only dlopen libraries signed by its own Team ID.
No copy of libheif is: not Homebrew's, and not the decode-only build
the app downloads, which is ad-hoc signed on arm64 and unsigned on
x86_64. So in a signed build every candidate is refused, the retry
after the install fails exactly like the first attempt did, and the
consent dialog opens again -- and again. Unsigned dev builds do not
enforce validation, which is why this only appeared once bundled.

The entitlement is the fix. The rest is so that a library that will
not load can never again present itself as one that is missing:

`download_would_help` now says no once the pinned bytes are already on
disk. Fetching the same five megabytes over the top cannot change the
mind of a loader that has already refused them, so the failure falls
through to the status line instead of back into the dialog. Bytes that
merely exist do not count -- a hash that does not match the pin is an
older managed build, which a download does replace.

And what reaches that status line is now worth reading: `libheif()`
kept only the last candidate's error, so the managed library's
rejection was overwritten by the system library's "image not found"
and the signature policy never surfaced. Every candidate reports.

The test-skip predicate keeps the old meaning under its own name,
`no_decoder_available`: a machine with no decoder should skip the
fixtures whether or not a download would do anything about it.
@IAmJSD
IAmJSD merged commit d16608f into main Aug 30, 2026
3 checks passed
@IAmJSD
IAmJSD deleted the fix/heic-download-loop-macos branch August 30, 2026 14:47
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.

1 participant