ZipArchive icon indicating copy to clipboard operation
ZipArchive copied to clipboard

Compilation with script sandboxing enabled fails with CocoaPods

Open krzysztof-grobelny opened this issue 11 months ago • 2 comments

Hi,

I'm facing a problem with compiling the project that has ENABLE_USER_SCRIPT_SANDBOXING enabled. I am observing the same issue in the provided examples.

When ObjectiveCExample or SwiftExample targets are configured to have ENABLE_USER_SCRIPT_SANDBOXING set to YES the "[CP] Copy Pods Resources" build phase fails eventually when attempting to alter SSZipArchive.bundle.

An example output:

error: Sandbox: rsync(88694) deny(1) file-write-create /Users/me/Library/Developer/Xcode/DerivedData/ZipArchiveExample-gwxmuzpnpfbmzncxsggkmtfzwvud/Build/Products/Debug-iphonesimulator/SwiftExample.app/Frameworks/SSZipArchive.framework/SSZipArchive.bundle (in target 'SwiftExample' from project 'ZipArchiveExample')
mkdir -p /Users/me/Library/Developer/Xcode/DerivedData/ZipArchiveExample-gwxmuzpnpfbmzncxsggkmtfzwvud/Build/Products/Debug-iphonesimulator/SwiftExample.app/Frameworks
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/me/Library/Developer/Xcode/DerivedData/ZipArchiveExample-gwxmuzpnpfbmzncxsggkmtfzwvud/Build/Products/Debug-iphonesimulator/SSZipArchive-iOS/SSZipArchive.framework" "/Users/me/Library/Developer/Xcode/DerivedData/ZipArchiveExample-gwxmuzpnpfbmzncxsggkmtfzwvud/Build/Products/Debug-iphonesimulator/SwiftExample.app/Frameworks"
Transfer starting: 8 files
rsync(88694): error: SSZipArchive.framework/SSZipArchive.bundle/: mkpathat: Operation not permitted
rsync(88694): error: rsync_uploader
rsync(88694): error: rsync_receiver
rsync(88693): error: unexpected end of file
rsync(88693): error: io_read_nonblocking
rsync(88693): error: io_read_blocking
rsync(88693): error: io_read_flush
rsync(88693): error: rsync_sender
rsync(88693): warning: child 88694 exited with status 1

Note: use_frameworks enabled or not - the issue persists.

I am unable to configure Input and Output Files of this Build Phase so that the error is gone. My gut feeling is that it is not a good idea to attempt to edit .app package.

Can you please assist me in having the problem solved? Sandboxed script execution is a requirement for our CI.

krzysztof-grobelny avatar Apr 10 '25 15:04 krzysztof-grobelny

I don't think you need ObjectiveCExample or SwiftExample for your project. All you have to do is include the Package.swift with Swift Package Manager.

I'm not sure if CocoaPods (which is deprecated in favor of SPM) is supporting ENABLE_USER_SCRIPT_SANDBOXING.

Coeur avatar Apr 15 '25 12:04 Coeur

It's clear that CocoaPods doesn't support ENABLE_USER_SCRIPT_SANDBOXING and will probably never support it considering it's end of life: https://github.com/CocoaPods/CocoaPods/issues/11946 https://github.com/CocoaPods/Xcodeproj/issues/990

Coeur avatar Apr 15 '25 13:04 Coeur