Skip to content

chore: embed Info.plist in dylib #15907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2024
Merged

chore: embed Info.plist in dylib #15907

merged 1 commit into from
Dec 18, 2024

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Dec 18, 2024

Relates to coder/coder-desktop-macos#2

This embeds:

  • "CoderVPN" as CFBundleName
  • The build version, e.g. 2.18.1-devel+1317c3043 as CFBundleVersion
  • The semantic version, e.g. 2.18.1 as CFBundleShortVersionString
  • The bundle identifier, com.coder.Coder-Desktop.VPN.dylib as CFBundleIdentifier.

into the __TEXT __info_plist section of the Coder VPN .dylib. This allows the Desktop app to read the version of the dylib after it's been downloaded.

There exists a Swift API for reading this section: https://developer.apple.com/documentation/corefoundation/1537134-cfbundlecopyinfodictionaryforurl

... This function will attempt to read an information dictionary from the (__TEXT, __info_plist) section of the file

$ codesign -dvvvv ./coder-vpn_2.18.1-devel+a8155f75a_darwin_arm64.dylib
Identifier=com.coder.Coder-Desktop.VPN.dylib
[...]
Info.plist entries=4
$ codesign -dvvvv ./coder-vpn_2.18.1-devel+a8155f75a_darwin_amd64.dylib
Identifier=com.coder.Coder-Desktop.VPN.dylib
[...]
Info.plist entries=4
$ otool -X -s __TEXT __info_plist ./coder-vpn_2.18.1-devel+a8155f75a_darwin_amd64.dylib | xxd -r
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>CoderVPN</string>
    <key>CFBundleIdentifier</key>
    <string>com.coder.Coder-Desktop.VPN.dylib</string>
    <key>CFBundleVersion</key>
    <string>2.18.1-devel+a8155f75a</string>
    <key>CFBundleShortVersionString</key>
    <string>2.18.1</string>
</dict>
</plist>

Note:
I initially tried to see if Info.plist could be embedded within the signature using rcodesign. It lets you supply an Info.plist but it would appear to only add the hash of the file to the signature, see example.
Inspecting the signature with codesign would return Info.plist=not bound.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson force-pushed the ethan/info-plist branch 11 times, most recently from d4f83dc to 95b31a0 Compare December 18, 2024 08:35
@ethanndickson ethanndickson changed the title chore: sign darwin binaries & dylib with an Info.plist chore: embed Info.plist in dylib Dec 18, 2024
@ethanndickson ethanndickson force-pushed the ethan/info-plist branch 2 times, most recently from 3ad8ad7 to 762b2c9 Compare December 18, 2024 09:08
@ethanndickson ethanndickson marked this pull request as ready for review December 18, 2024 09:13
@ethanndickson ethanndickson enabled auto-merge (squash) December 18, 2024 10:51
@ethanndickson ethanndickson merged commit 01f2ac0 into main Dec 18, 2024
34 checks passed
@ethanndickson ethanndickson deleted the ethan/info-plist branch December 18, 2024 11:08
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants