Make PowerPoint import reliable in the App Store sandbox - #81
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Improves PPTX presenter-notes import reliability under the Mac App Store sandbox by ensuring the user-selected archive is first copied into Textream’s own temporary directory before invoking the unzip child process.
Changes:
- Copy the selected
.pptxinto a temporary directory owned by the app process. - Update the
unzipinvocation to operate on the copied archive instead of the original security-scoped URL.
Suppressed comments (1)
Textream/Textream/PresentationNotesExtractor.swift:62
- Using
/usr/bin/unzipon a user-selected PPTX without validating archive entry paths can allow “zip slip” path traversal (e.g.../) and/or symlink tricks, potentially writing files outside the intended extraction directory. Consider switching to a ZIP extraction approach that normalizes each entry path and enforces that the destination stays within the extraction root (or at minimum, validate extracted paths and reject archives with unsafe entries).
// Unzip using Process
let process = Process()
process.executableURL = URL(fileURLWithPath: "/usr/bin/unzip")
process.arguments = ["-o", "-q", localArchive.path, "-d", tempDir.path]
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+49
to
+53
| // Copy the security-scoped document into Textream's own temporary | ||
| // directory before handing it to a child process. This keeps PPTX | ||
| // import reliable inside the Mac App Store sandbox. | ||
| let localArchive = tempDir.appendingPathComponent("presentation.pptx") | ||
| do { |
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.
Summary
Copy a user-selected PowerPoint file into Textream’s own temporary directory before invoking the system unzip tool. This preserves the security-scoped read in the app process and makes presenter-note import reliable under the Mac App Store sandbox.
Verification
arm64andx86_64git diff --checkPrepared with Codex assistance; reviewed and submitted by Fatih.