Skip to content

Commit e8e57d0

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 e8e57d0

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

dev/bots/suite_runners/run_verify_binaries_codesigned_tests.dart

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
8787
return <String>[
8888
'artifacts/engine/darwin-x64-profile/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
8989
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
90-
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64/dSYMs/FlutterMacOS.framework.dSYM/Contents/Resources/DWARF/FlutterMacOS',
9190
'artifacts/engine/darwin-x64/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
9291
'artifacts/engine/darwin-x64/font-subset',
9392
'artifacts/engine/darwin-x64/impellerc',
@@ -98,10 +97,8 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
9897
'artifacts/engine/ios-profile/extension_safe/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
9998
'artifacts/engine/ios-profile/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
10099
'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',
102100
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
103101
'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',
105102
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
106103
'artifacts/engine/ios/Flutter.xcframework/ios-arm64/Flutter.framework/Flutter',
107104
'artifacts/engine/ios/Flutter.xcframework/ios-arm64_x86_64-simulator/Flutter.framework/Flutter',
@@ -112,6 +109,21 @@ List<String> binariesWithoutEntitlements(String flutterRoot) {
112109
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
113110
}
114111

112+
/// Binaries that are not expected to be codesigned.
113+
///
114+
/// This list should be kept in sync with the actual contents of Flutter's cache.
115+
List<String> unsignedBinaries(String flutterRoot) {
116+
return <String>[
117+
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64/dSYMs/FlutterMacOS.framework.dSYM/Contents/Resources/DWARF/FlutterMacOS',
118+
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
119+
'artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_x86_64-simulator/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
120+
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
121+
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework/ios-arm64_x86_64-simulator/dSYMs/Flutter.framework.dSYM/Contents/Resources/DWARF/Flutter',
122+
]
123+
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
124+
}
125+
126+
115127
/// xcframeworks that are expected to be codesigned.
116128
///
117129
/// This list should be kept in sync with the actual contents of Flutter's
@@ -136,8 +148,8 @@ List<String> signedXcframeworks(String flutterRoot) {
136148
/// This function ignores code signatures and entitlements, and is intended to
137149
/// be run on every commit. It should throw if either new binaries are added
138150
/// to the cache or expected binaries removed. In either case, this class'
139-
/// [binariesWithEntitlements] or [binariesWithoutEntitlements] lists should
140-
/// be updated accordingly.
151+
/// [binariesWithEntitlements], [binariesWithoutEntitlements], and
152+
/// [unsignedBinaries] lists should be updated accordingly.
141153
Future<void> verifyExist(
142154
String flutterRoot,
143155
{@visibleForTesting ProcessManager processManager = const LocalProcessManager()
@@ -146,16 +158,18 @@ Future<void> verifyExist(
146158
path.join(flutterRoot, 'bin', 'cache'),
147159
processManager: processManager,
148160
);
149-
final List<String> allExpectedFiles = binariesWithEntitlements(flutterRoot) + binariesWithoutEntitlements(flutterRoot);
161+
final List<String> expectedSigned = binariesWithEntitlements(flutterRoot) + binariesWithoutEntitlements(flutterRoot);
162+
final List<String> expectedUnsigned = unsignedBinaries(flutterRoot);
150163
final Set<String> foundFiles = <String>{
151164
for (final String binaryPath in binaryPaths)
152-
if (allExpectedFiles.contains(binaryPath)) binaryPath
165+
if (expectedSigned.contains(binaryPath)) binaryPath
166+
else if (expectedUnsigned.contains(binaryPath)) binaryPath
153167
else throw Exception('Found unexpected binary in cache: $binaryPath'),
154168
};
155169

156-
if (foundFiles.length < allExpectedFiles.length) {
170+
if (foundFiles.length < expectedSigned.length) {
157171
final List<String> unfoundFiles = <String>[
158-
for (final String file in allExpectedFiles) if (!foundFiles.contains(file)) file,
172+
for (final String file in expectedSigned) if (!foundFiles.contains(file)) file,
159173
];
160174
print(
161175
'Expected binaries not found in cache:\n\n${unfoundFiles.join('\n')}\n\n'
@@ -195,6 +209,11 @@ Future<void> verifySignatures(
195209
if (signedXcframeworks(flutterRoot).contains(pathToCheck)) {
196210
verifySignature = true;
197211
}
212+
if (unsignedBinaries(flutterRoot).contains(pathToCheck)) {
213+
// Binary is expected to be unsigned. No need to check signature, entitlements.
214+
continue;
215+
}
216+
198217
if (!verifySignature && !verifyEntitlements) {
199218
unexpectedFiles.add(pathToCheck);
200219
print('Unexpected binary or xcframework $pathToCheck found in cache!');

0 commit comments

Comments
 (0)