[codex] Harden Quick Look preview sandbox#385
Merged
schuyler merged 2 commits intoApr 19, 2026
Merged
Conversation
Owner
|
Nice layered hardening — CSP + disabled JS + nav-cancel + entitlement drop is solid defense in depth, and I like that tests cover both the CSP presence and the absence of embedded Prism scripts. A few non-blocking observations:
None of these are blockers — LGTM. Generated by Claude Code |
This was referenced Jun 29, 2026
schuyler
added a commit
that referenced
this pull request
Jun 30, 2026
## Summary - Add MacDownCore (framework) and MacDownQuickLook (app extension) as native targets in the Xcode project - Wire CocoaPods dependencies for both targets - Embed the Quick Look extension in the main app bundle - Remove `public.text` from `QLSupportedContentTypes` so the extension only claims markdown files ## Background The Quick Look source code was merged in PRs #299, #368, and #385 but the Xcode project was never configured to build it. This caused 3000.0.6 to register the QL handler without providing a working preview — worse than the macOS default. ## Key decisions - **Resource copying via script phase**: MacDownCore copies Styles and Prism resources via its own shell script build phase rather than reusing MacDown's PBXFileReferences. Those refs are declared outputs of MacDown's "Fetch Prism Resources" and "Transpile Styles" script phases, which would create a dependency cycle. - **No MacDown→MacDownCore dependency**: The main app only depends on MacDownQuickLook. MacDownCore is embedded inside the extension only, since only the extension uses it. - **Per-configuration bundle IDs**: Debug uses `-debug` suffix to match the parent app's pattern. ## Test plan - [ ] `xcodebuild build` succeeds (verified locally) - [ ] 1003 tests pass with 0 unexpected failures (verified locally) - [ ] `.app` bundle contains `MacDownQuickLook.appex` in `Contents/PlugIns/` (verified locally) - [ ] `MacDownQuickLook.appex` contains `MacDownCore.framework` with `Styles/` and `Prism/` resources (verified locally) - [ ] Quick Look preview renders markdown files in Finder - [ ] Quick Look does NOT activate for `.txt`, `.csv`, or other non-markdown text files Related to #284
schuyler
added a commit
that referenced
this pull request
Jun 30, 2026
## Summary - Add MacDownCore (framework) and MacDownQuickLook (app extension) as native targets in the Xcode project - Wire CocoaPods dependencies for both targets - Embed the Quick Look extension in the main app bundle - Remove `public.text` from `QLSupportedContentTypes` so the extension only claims markdown files ## Background The Quick Look source code was merged in PRs #299, #368, and #385 but the Xcode project was never configured to build it. This caused 3000.0.6 to register the QL handler without providing a working preview — worse than the macOS default. ## Key decisions - **Resource copying via script phase**: MacDownCore copies Styles and Prism resources via its own shell script build phase rather than reusing MacDown's PBXFileReferences. Those refs are declared outputs of MacDown's "Fetch Prism Resources" and "Transpile Styles" script phases, which would create a dependency cycle. - **No MacDown→MacDownCore dependency**: The main app only depends on MacDownQuickLook. MacDownCore is embedded inside the extension only, since only the extension uses it. - **Per-configuration bundle IDs**: Debug uses `-debug` suffix to match the parent app's pattern. ## Test plan - [ ] `xcodebuild build` succeeds (verified locally) - [ ] 1003 tests pass with 0 unexpected failures (verified locally) - [ ] `.app` bundle contains `MacDownQuickLook.appex` in `Contents/PlugIns/` (verified locally) - [ ] `MacDownQuickLook.appex` contains `MacDownCore.framework` with `Styles/` and `Prism/` resources (verified locally) - [ ] Quick Look preview renders markdown files in Finder - [ ] Quick Look does NOT activate for `.txt`, `.csv`, or other non-markdown text files Related to #284
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
Why
Quick Look was rendering attacker-controlled Markdown into a live WKWebView with script execution paths and outbound network capability. A malicious file previewed in Finder could execute JavaScript and exfiltrate document content without opening the main app.
Root cause
The Quick Look path reused the normal rendered HTML body, appended executable Prism scripts, left WebKit JavaScript enabled, and shipped a sandbox entitlement for outbound network access.
Validation
xcodebuild test -workspace "MacDown 3000.xcworkspace" -scheme MacDown -destination "platform=macOS"