Skip to content

Commit b96b7f6

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 a495ac5 commit b96b7f6

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
@@ -98,10 +98,8 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
9898
'artifacts/engine/ios-profile/extension_safe/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
9999
'artifacts/engine/ios-profile/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
100100
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
101-
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
102101
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/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/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
107105
'artifacts/engine/ios/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
@@ -112,6 +110,21 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
112110
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
113111
}
114112

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

156-
if (foundFiles.length < allExpectedFiles.length) {
171+
if (foundFiles.length < expectedSigned.length) {
157172
final List<String> unfoundFiles = <String>[
158-
for (final String file in allExpectedFiles) if (!foundFiles.contains(file)) file,
173+
for (final String file in expectedSigned) if (!foundFiles.contains(file)) file,
159174
];
160175
print(
161176
'Expected binaries not found in cache:\n\n${unfoundFiles.join('\n')}\n\n'
@@ -195,6 +210,11 @@ Future<void> verifySignatures(
195210
if (signedXcframeworks(flutterRoot).contains(pathToCheck)) {
196211
verifySignature = true;
197212
}
213+
if (unsignedBinaries(flutterRoot).contains(pathToCheck)) {
214+
// Binary is expected to be unsigned. No need to check signature, entitlements.
215+
continue;
216+
}
217+
198218
if (!verifySignature && !verifyEntitlements) {
199219
unexpectedFiles.add(pathToCheck);
200220
print('Unexpected binary or xcframework $pathToCheck found in cache!');

0 commit comments

Comments
 (0)