Xcode 14 beta 3 "ditto ... Operation not permitted"

We've got a built script for a macOS app that copies a menu extension (.app bundle) via "ditto" which suddenly is throwing a "Operation not permitted" error in Xcode 14 beta 3. We've had no issues since Xcode 10 with the same script (has never changed):

EXTAPP="XXXXXX.com.my.app.ext.app"
if [ $CONFIGURATION == Debug ]
then
 EXTAPP="XXXXXX.com.my.app.ext.app-debug.app"
fi

TARGET_LOCATION="${BUILT_PRODUCTS_DIR}/MyApp.app/Contents/Library/LoginItems/${EXTAPP}"

// FAILS HERE:
ditto "${BUILT_PRODUCTS_DIR}/${EXTAPP}" "${TARGET_LOCATION}"

echo "Codesign..."

SHA="${EXPANDED_CODE_SIGN_IDENTITY}"
codesign --preserve-metadata=entitlements --deep --verify --options runtime --force --sign $SHA "${TARGET_LOCATION}"

Seeing this error:

ditto: ...MyApp.app/Contents/Library/LoginItems/XXXXXX.com.my.app.ext.app-debug.app/Contents: Operation not permitted

It seems to be caused by enabling ENABLE_USER_SCRIPT_SANDBOXING. It was working fine in Xcode 14 beta 1 and 2 though. The Input Files and Output Files have been correctly specified though, yet it seems to be failing.

Xcode 14 beta 3 "ditto ... Operation not permitted"
 
 
Q