Coder Social home page Coder Social logo

Comments (3)

roblabla avatar roblabla commented on August 15, 2024

I think the problem comes from as_nested_macho_settings. Essentially, in import_settings_from_macho, we set the binary_identifier for each sub-binary using the SettingsScope::MultiArchIndex scope. The problem is, this happens before the Info.plist is parsed and sets the binary_identifier at the Main scope level (as evidenced by the logs:

WARN apple_codesign::bundle_signing: signing main executable Contents/MacOS/test
    at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/apple-codesign-0.17.0/src/bundle_signing.rs:574
INFO apple_codesign::signing_settings: inferring default signing settings from Mach-O binary
    at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/apple-codesign-0.17.0/src/signing_settings.rs:754
INFO apple_codesign::signing_settings: preserving existing binary identifier in Mach-O
    at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/apple-codesign-0.17.0/src/signing_settings.rs:809
INFO apple_codesign::signing_settings: using team ID from settings
    at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/apple-codesign-0.17.0/src/signing_settings.rs:817
INFO apple_codesign::signing_settings: using code signature flags from settings
    at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/apple-codesign-0.17.0/src/signing_settings.rs:828
INFO apple_codesign::bundle_signing: setting main executable binary identifier to quick.test (derived from CFBundleIdentifier in Info.plist)
    at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/apple-codesign-0.17.0/src/bundle_signing.rs:589

So we now have a SigningSettings that contains both a binary_identifier on scope Main, and binary_identifiers with scope SettingsScope::MultiArchIndex. At this point, as_nested_macho_settings, through clone_with_filter_map, will bring the binary_identifiers with the correct MultiArchIndex scope into the Main scope, potentially colliding with the one set by the Info.plist. And at that point, hell ensues.


I think the proper solution is to either parse the Info.plist first, or make it so that when we set a binary identifier with the main scope in the SigningSettings, it automatically drops those in the Multi* subscopes.

from apple-platform-rs.

roblabla avatar roblabla commented on August 15, 2024

FWIW: I found out about this because TCC had the weirdest behavior with my binaries. My app needs "Full Disk Access" permission, and when I'd tick the box to give it in the "Security & Privacy" preference pannel, it'd untick the next time I'd start. After a lot of debugging, I figured that those different bundle identifiers were the cause! The AArch64 binary didn't match the Info.plist, so macos was very confused about it!

from apple-platform-rs.

indygreg avatar indygreg commented on August 15, 2024

Thanks for filing this.

The binary identifier logic is a bit convoluted and I'm honestly not sure what the correct logic should be! I feel like someone will have to test what codesign does and then emulate that behavior in our code.

from apple-platform-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.