From 5dfe4ce71b702f66055e388adbe03f9792b9c0c6 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 1 Aug 2016 22:02:18 -0400 Subject: [PATCH] Set up ATS exceptions for Test App in release mode Now the test app works properly when building it in release. --- ... set-ats-exceptions-downloader-service.sh} | 2 +- Configurations/set-ats-exceptions-test-app.sh | 15 +++++++++ Sparkle.xcodeproj/project.pbxproj | 33 ++++++++++++++----- 3 files changed, 41 insertions(+), 9 deletions(-) rename Configurations/{set-ats-exceptions.sh => set-ats-exceptions-downloader-service.sh} (78%) create mode 100755 Configurations/set-ats-exceptions-test-app.sh diff --git a/Configurations/set-ats-exceptions.sh b/Configurations/set-ats-exceptions-downloader-service.sh similarity index 78% rename from Configurations/set-ats-exceptions.sh rename to Configurations/set-ats-exceptions-downloader-service.sh index 79391535..9b5fa1b9 100755 --- a/Configurations/set-ats-exceptions.sh +++ b/Configurations/set-ats-exceptions-downloader-service.sh @@ -7,6 +7,6 @@ case "${SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS}" in /usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${INFOPLIST}" ;; "NO"|"0") -/usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity" "${INFOPLIST}" +/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO" "${INFOPLIST}" ;; esac diff --git a/Configurations/set-ats-exceptions-test-app.sh b/Configurations/set-ats-exceptions-test-app.sh new file mode 100755 index 00000000..6f62badb --- /dev/null +++ b/Configurations/set-ats-exceptions-test-app.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# We should make sure ATS is off for the test app + +TEMPORARY_INFO_PLIST="${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/"XPCServices"/"${TEMPORARY_DOWNLOADER_BUNDLE_ID}.xpc"/"Contents"/"Info.plist" + +PERSISTENT_INFO_PLIST="${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/"XPCServices"/"${PERSISTENT_DOWNLOADER_BUNDLE_ID}.xpc"/"Contents"/"Info.plist" + +#Only alter bundles if code signing is off, else we'll invalidate the signature on them +#If code signing is enabled (as in debug mode), then we rely on another script for turning ATS exceptions on for these services +#In release mode however, those services do not have ATS exceptions set up which is why we have to set up exceptions *here* +if [ -z ${CODE_SIGN_IDENTITY}] ; then + /usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${TEMPORARY_INFO_PLIST}" + /usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${PERSISTENT_INFO_PLIST}" +fi diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index b001ead3..0e4a7e6e 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -957,6 +957,8 @@ 728639041CAF614000783084 /* ConfigTemporaryDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTemporaryDownloader.xcconfig; sourceTree = ""; }; 7293A1AC1CEE933800B957A7 /* SUURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUURLRequest.h; sourceTree = ""; }; 7293A1AD1CEE933800B957A7 /* SUURLRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUURLRequest.m; sourceTree = ""; }; + 729BB3CD1D503253007C4276 /* set-ats-exceptions-test-app.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-ats-exceptions-test-app.sh"; sourceTree = ""; }; + 729BB3CE1D50344A007C4276 /* set-ats-exceptions-downloader-service.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-ats-exceptions-downloader-service.sh"; sourceTree = ""; }; 729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITest.xcconfig; sourceTree = ""; }; 729F10FE1C65A9B500DFCCC5 /* ConfigUITestCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestCoverage.xcconfig; sourceTree = ""; }; 72A450511C69A68900D67EEA /* SUUpdatePermission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermission.h; sourceTree = ""; }; @@ -1013,7 +1015,6 @@ 72E45DDC1B65C3BD005C701A /* sign_update */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = sign_update; path = bin/sign_update; sourceTree = SOURCE_ROOT; }; 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; }; 72F94EB01CC2A865002DEE68 /* ConfigCommonReleaseHTTP.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigCommonReleaseHTTP.xcconfig; sourceTree = ""; }; - 72F94ED31CC33F1E002DEE68 /* set-ats-exceptions.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-ats-exceptions.sh"; sourceTree = ""; }; 72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerLauncherDebug.xcconfig; sourceTree = ""; }; 72F94ED61CC344A7002DEE68 /* ConfigPersistentDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigPersistentDownloaderDebug.xcconfig; sourceTree = ""; }; 72F94ED71CC344E4002DEE68 /* ConfigTemporaryDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTemporaryDownloaderDebug.xcconfig; sourceTree = ""; }; @@ -1819,7 +1820,8 @@ 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */, 14732BC91960F70A00593899 /* make-release-package.sh */, 14652F7919A93E5F00959E44 /* set-git-version-info.sh */, - 72F94ED31CC33F1E002DEE68 /* set-ats-exceptions.sh */, + 729BB3CE1D50344A007C4276 /* set-ats-exceptions-downloader-service.sh */, + 729BB3CD1D503253007C4276 /* set-ats-exceptions-test-app.sh */, 721D8A831D498F1D0032E472 /* set-agent-signing.sh */, 146EC84E19A68CF8004A50C5 /* Sparkle.podspec */, ); @@ -1978,6 +1980,7 @@ 61B5F90009C4CEE200B25A18 /* Frameworks */, 61B5FB4D09C4E9FA00B25A18 /* Copy Frameworks */, 726E4A261C86C88F00C57C6A /* Embed XPC Services */, + 729BB3CC1D501A8F007C4276 /* Run Script */, ); buildRules = ( ); @@ -2091,7 +2094,7 @@ 726E07EB1CAF37BD001A286B /* Sources */, 726E07EC1CAF37BD001A286B /* Frameworks */, 726E07ED1CAF37BD001A286B /* Resources */, - 728639061CAF651300783084 /* ShellScript */, + 729BB3D01D50354C007C4276 /* ShellScript */, ); buildRules = ( ); @@ -2126,7 +2129,7 @@ 728638EF1CAF5A5F00783084 /* Sources */, 728638F01CAF5A5F00783084 /* Frameworks */, 728638F11CAF5A5F00783084 /* Resources */, - 72F94ED41CC33F35002DEE68 /* ShellScript */, + 729BB3CF1D503531007C4276 /* ShellScript */, ); buildRules = ( ); @@ -2517,20 +2520,21 @@ shellPath = /bin/sh; shellScript = "\"$SRCROOT/Configurations/set-agent-signing.sh\""; }; - 728639061CAF651300783084 /* ShellScript */ = { + 729BB3CC1D501A8F007C4276 /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); + name = "Run Script"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "${SRCROOT}/Configurations/set-ats-exceptions.sh"; + shellScript = "${SRCROOT}/Configurations/set-ats-exceptions-test-app.sh"; }; - 72F94ED41CC33F35002DEE68 /* ShellScript */ = { + 729BB3CF1D503531007C4276 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -2541,7 +2545,20 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "${SRCROOT}/Configurations/set-ats-exceptions.sh"; + shellScript = "${SRCROOT}/Configurations/set-ats-exceptions-downloader-service.sh"; + }; + 729BB3D01D50354C007C4276 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "${SRCROOT}/Configurations/set-ats-exceptions-downloader-service.sh"; }; /* End PBXShellScriptBuildPhase section */