Skip to content

Commit bb7d645

Browse files
committed
iOS,macOS: Add list of expected-unsigned binaries
This updates the codesigning test to account for iOS and macOS binaries in the artifact cache that are _expected_ to not be codesigned. In flutter/engine#54414 we started bundling dSYM (debugging symbols) within Flutter.xcframework, a requirement for App Store verification using Xcode 16. We did the same for macOS in flutter/engine#54696. Unlike the framework dylib, dSYM contents are not directly codesigned (though the xcframework containing them is). Issue: flutter#154571
1 parent 4cf269e commit bb7d645

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

dev/bots/suite_runners/run_verify_binaries_codesigned_tests.dart

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,9 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
9797
'artifacts/engine/ios-profile/extension_safe/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
9898
'artifacts/engine/ios-profile/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
9999
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
100-
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
101100
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
102101
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
103102
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
104-
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
105103
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
106104
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
107105
'artifacts/engine/ios/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
@@ -113,6 +111,21 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
113111
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
114112
}
115113

114+
/// Binaries that are not expected to be codesigned.
115+
///
116+
/// This list should be kept in sync with the actual contents of Flutter's cache.
117+
List<String> unsignedBinaries(String flutterRoot) {
118+
return <String>[
119+
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64/dSYMs/FlutterMacOS.framework.dSYM/Contents/Resources/DWARF/FlutterMacOS',
120+
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
121+
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
122+
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
123+
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
124+
]
125+
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
126+
}
127+
128+
116129
/// xcframeworks that are expected to be codesigned.
117130
///
118131
/// This list should be kept in sync with the actual contents of Flutter's
@@ -137,8 +150,8 @@ List<String> signedXcframeworks(String flutterRoot) {
137150
/// This function ignores code signatures and entitlements, and is intended to
138151
/// be run on every commit. It should throw if either new binaries are added
139152
/// to the cache or expected binaries removed. In either case, this class'
140-
/// [binariesWithEntitlements] or [binariesWithoutEntitlements] lists should
141-
/// be updated accordingly.
153+
/// [binariesWithEntitlements], [binariesWithoutEntitlements], and
154+
/// [unsignedBinaries] lists should be updated accordingly.
142155
Future<void> verifyExist(
143156
String flutterRoot,
144157
{@visibleForTesting ProcessManager processManager = const LocalProcessManager()
@@ -147,16 +160,18 @@ Future<void> verifyExist(
147160
path.join(flutterRoot, 'bin', 'cache'),
148161
processManager: processManager,
149162
);
150-
final List<String> allExpectedFiles = binariesWithEntitlements(flutterRoot) + binariesWithoutEntitlements(flutterRoot);
163+
final List<String> expectedSigned = binariesWithEntitlements(flutterRoot) + binariesWithoutEntitlements(flutterRoot);
164+
final List<String> expectedUnsigned = unsignedBinaries(flutterRoot);
151165
final Set<String> foundFiles = <String>{
152166
for (final String binaryPath in binaryPaths)
153-
if (allExpectedFiles.contains(binaryPath)) binaryPath
167+
if (expectedSigned.contains(binaryPath)) binaryPath
168+
else if (expectedUnsigned.contains(binaryPath)) binaryPath
154169
else throw Exception('Found unexpected binary in cache: $binaryPath'),
155170
};
156171

157-
if (foundFiles.length < allExpectedFiles.length) {
172+
if (foundFiles.length < expectedSigned.length) {
158173
final List<String> unfoundFiles = <String>[
159-
for (final String file in allExpectedFiles) if (!foundFiles.contains(file)) file,
174+
for (final String file in expectedSigned) if (!foundFiles.contains(file)) file,
160175
];
161176
print(
162177
'Expected binaries not found in cache:\n\n${unfoundFiles.join('\n')}\n\n'
@@ -196,6 +211,11 @@ Future<void> verifySignatures(
196211
if (signedXcframeworks(flutterRoot).contains(pathToCheck)) {
197212
verifySignature = true;
198213
}
214+
if (unsignedBinaries(flutterRoot).contains(pathToCheck)) {
215+
// Binary is expected to be unsigned. No need to check signature, entitlements.
216+
continue;
217+
}
218+
199219
if (!verifySignature && !verifyEntitlements) {
200220
unexpectedFiles.add(pathToCheck);
201221
print('Unexpected binary or xcframework $pathToCheck found in cache!');

0 commit comments

Comments
 (0)