iOS: add CodePushDiffManifest for parsing diff manifests - #58
Draft
ofalvai wants to merge 1 commit into
Draft
Conversation
ofalvai
added this pull request to stack #57
September 9, 2026 06:44
There was a problem hiding this comment.
🟡 Changes recommended
The parser silently accepts several malformed version and collection values, potentially interpreting manifests incorrectly.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds iOS support for parsing versioned diff manifests and safely resolving manifest paths.
Changes:
- Adds diff-manifest models, parsing, and secure path resolution.
- Adds unit tests for parsing and path traversal.
- Registers implementation and tests with Xcode targets.
File summaries
| File | Description |
|---|---|
ios/CodePushTests/CodePushTests-Bridging-Header.h |
Exposes the manifest API to Swift tests. |
ios/CodePushTests/CodePushDiffManifestTests.swift |
Tests parsing and path safety. |
ios/CodePush/CodePushDiffManifest.m |
Implements manifest parsing and path resolution. |
ios/CodePush/CodePushDiffManifest.h |
Defines manifest models and APIs. |
ios/CodePush.xcodeproj/project.pbxproj |
Adds sources and tests to Xcode targets. |
Review details
Suppressed comments (2)
ios/CodePush/CodePushDiffManifest.m:118
- A present but non-array
deletedFilesvalue is currently treated exactly like an omitted field, so malformed input such as{"deletedFiles":"old.js"}parses successfully and silently retains files that the manifest intended to remove. Reject non-null values of the wrong container type before applying the optional-field default.
NSArray *deletedFilesJSON = json[@"deletedFiles"];
NSMutableArray<NSString *> *deletedFiles = [NSMutableArray array];
if ([deletedFilesJSON isKindOfClass:[NSArray class]]) {
ios/CodePush/CodePushDiffManifest.m:130
- A present
patchedFilesvalue with the wrong container type is silently converted to an empty dictionary. For a version 2 update this skips every declared binary patch rather than reporting a malformed manifest, which can leave copied old-package bytes in the candidate update. Reject non-null, non-dictionary values before parsing entries.
NSDictionary *patchedFilesJSON = json[@"patchedFiles"];
NSMutableDictionary<NSString *, CodePushPatchedFileEntry *> *patchedFiles = [NSMutableDictionary dictionary];
if ([patchedFilesJSON isKindOfClass:[NSDictionary class]]) {
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+109
to
+113
| if (![versionValue isKindOfClass:[NSNumber class]]) { | ||
| if (error) *error = malformedManifestError([NSString stringWithFormat:@"Diff manifest field \"version\" must be a number, but is \"%@\"", versionValue]); | ||
| return nil; | ||
| } | ||
| version = [versionValue integerValue]; |
ofalvai
force-pushed
the
ios-diff-manifest-parsing
branch
from
September 9, 2026 15:37
9a29a6d to
e412e2c
Compare
ofalvai
force-pushed
the
ios-diff-manifest-parsing
branch
from
September 9, 2026 18:11
e412e2c to
9556661
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with GitHub Stacks CLI • Give Feedback 💬