macOS builds without an Xcode project end up with a broken code signature (Apple.Core edits the .app after Unity signs it)

Đang mở
#132 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp, macos, unity
Lĩnh vực
build-system, desktop

Hướng nghiên cứu

Start with AppleBuild.OnPostProcessBuild and the Info.plist, frameworks, and entitlements steps described in the issue; check how the build target and Xcode project setting are detected. Reproduce with a plain macOS .app and run codesign --verify --deep --strict --verbose=2 on it. Done means the resulting app verifies successfully and follows the issue’s expected handling of settings, bundles, and signing.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug Plugin-in - Core

Describe the bug
When building for macOS with "Create Xcode Project" off (a plain .app, e.g. for Steam), AppleBuild.OnPostProcessBuild changes the .app after Unity has already signed it, and nothing signs it again:

  • Automate Info.plist rewrites Contents/Info.plist (adds ITSAppUsesNonExemptEncryption, plus LSMinimumSystemVersion when Apple Build Settings has a minimum macOS version).
  • The frameworks step copies AppleCoreNativeMac.bundle, GameKitWrapper.bundle and their .dSYM folders into Contents/PlugIns.
  • Automate Entitlements writes <Product Name>.entitlements next to the .app, where nothing uses it.

In one of our Steam builds, the Info.plist hash stored in the main executable's ad-hoc signature no longer matches Contents/Info.plist, and _CodeSignature/CodeResources lists every bundle in Contents/PlugIns except AppleCoreNativeMac.bundle and GameKitWrapper.bundle.

To Reproduce

  1. Project with Apple.Core and Apple.GameKit, Automate Info.plist and Automate Entitlements on (the defaults).
  2. Build for macOS with Create Xcode Project off.
  3. Run codesign --verify --deep --strict --verbose=2 on the built .app. It fails.

Expected behavior
The .app Unity produced stays validly signed. The Info.plist keys and the entitlements file are App Store settings a plain .app can't use, so skip them in this case (or apply them before Unity signs). Keep .dSYM folders out of Contents/PlugIns, and re-sign the .app after copying the plug-in bundles into it.

Environment
Unity 6000.6, macOS Standalone (Apple Silicon), Create Xcode Project off. Seen with Apple.Core 3.2.0 / Apple.GameKit 4.0.1; the code is unchanged in 3.3.0 / 4.1.0 (27.0, ffe6174) and on main (96e4a04).

Additional context
What we patch into our embedded copy:

bool isPlainMacApp = buildTarget == BuildTarget.StandaloneOSX && !AppleNativeLibraryUtility.IsXcodeProjectGeneratedForMac;
// skip the Info.plist and entitlements regions when isPlainMacApp, then after the finalize step:
if (isPlainMacApp)
{
    // runs /usr/bin/codesign --force --sign - "<app>" (ad-hoc, the way Unity signed it)
    ResignPlainMacApp(generatedProjectPath);
}
Ngôn ngữ chính
C#
Star
1k
Fork
257
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apple/unityplugins

Tất cả issue của apple/unityplugins

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.