Skip to content

iOS: apply bsdiff patches during package install - #48

Draft
ofalvai wants to merge 1 commit into
ios-binary-diff-patcherfrom
ios-apply-patches
Draft

iOS: apply bsdiff patches during package install#48
ofalvai wants to merge 1 commit into
ios-binary-diff-patcherfrom
ios-apply-patches

Conversation

@ofalvai

@ofalvai ofalvai commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Context

iOS counterpart of #42 and #43. Builds on top of #44 and #47.

Summary of changes

Existing package install code in CodePushPackage.m has a lot of questionable untrusted file path handling code, as well as a few bugs that I fixed along the way. Unfortunately, the iOS SDK has no equivalent of Java's

so this PR is a bit bigger than what I expected.

@ofalvai ofalvai changed the title ios apply patches iOS: apply bsdiff patches during package install Aug 28, 2026
@ofalvai
ofalvai force-pushed the ios-apply-patches branch from c9f5d13 to 5aefe55 Compare August 28, 2026 14:20
@ofalvai
ofalvai force-pushed the ios-apply-patches branch from 5aefe55 to 2a740c0 Compare August 31, 2026 12:10
NSArray *deletedFiles = manifestJSON[@"deletedFiles"];
for (NSString *deletedFileName in deletedFiles) {
NSString *absoluteDeletedFilePath = [newUpdateFolderPath stringByAppendingPathComponent:deletedFileName];
if (error) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: unhandled error from [NSJSONSerialization JSONObjectWithData] :)

@ofalvai
ofalvai removed this pull request from stack #41 September 9, 2026 06:38
@ofalvai
ofalvai changed the base branch from ios-sha256-refactor to ios-binary-diff-patcher September 9, 2026 06:47
@ofalvai
ofalvai added this pull request to stack #57 September 9, 2026 06:47
Copilot AI balanced review requested due to automatic review settings September 9, 2026 15:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Duplicate Xcode object IDs, a breaking public selector change, and missing install-orchestration coverage must be addressed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds opt-in iOS support for applying bsdiff patches during package installation.

Changes:

  • Parses and validates diff manifests before safely applying binary patches.
  • Adds the CodePushEnableDeltaUpdates configuration flag.
  • Updates iOS project wiring and setup documentation.
File summaries
File Description
ios/CodePush/CodePushPackage.m Integrates manifest validation and binary patch application.
ios/CodePush/CodePushConfig.m Reads the delta-update flag from Info.plist.
ios/CodePush/CodePush.m Passes the configuration into package downloads.
ios/CodePush/CodePush.h Exposes the flag and updated download method.
ios/CodePush.xcodeproj/project.pbxproj Adds binary patcher test-target references.
docs/setup-ios.md Documents enabling delta updates.
Review details

Suppressed comments (1)

ios/CodePush.xcodeproj/project.pbxproj:204

  • This PBXFileReference uses the same object ID as the existing definition at line 207. Duplicate PBX object keys can be collapsed or rejected by Xcode tooling; remove the duplicate definition so the test file has one reference object.
		F42FA68BF21AED765F55E71A /* CodePushBinaryDiffPatcherTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CodePushBinaryDiffPatcherTests.swift; sourceTree = "<group>"; };
  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

/* Begin PBXBuildFile section */
08B8B3B8260E70B7ECA85451 /* bspatch_bridge.c in Sources */ = {isa = PBXBuildFile; fileRef = A430CBE260F09A3233110E28 /* bspatch_bridge.c */; };
BBC7F97A68E454FB38953FC4 /* CodePushDiffManifestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9645879798B46D35D8D824F8 /* CodePushDiffManifestTests.swift */; };
3643F3729205426163367671 /* CodePushBinaryDiffPatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42FA68BF21AED765F55E71A /* CodePushBinaryDiffPatcherTests.swift */; };
Comment thread ios/CodePush/CodePush.h
+ (void)downloadPackage:(NSDictionary *)updatePackage
expectedBundleFileName:(NSString *)expectedBundleFileName
publicKey:(NSString *)publicKey
enableDeltaUpdates:(BOOL)enableDeltaUpdates
Comment on lines +45 to +49
if (diffManifest.version > 2 || diffManifest.version < 1) {
*error = [CodePushErrorUtils errorWithMessage:
[NSString stringWithFormat:@"Diff manifest version %ld is not supported by this SDK version.", (long)diffManifest.version]];
return NO;
} else if (diffManifest.version == 2 && !enableDeltaUpdates) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants