audit-swiftui-sandbox-files

Audits macOS SwiftUI projects for App Sandbox file-access, bookmark, and entitlement defects.

2|1|Updated Jun 7, 2026
One-click install
npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-sandbox-files-yigitkonur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-swiftui-sandbox-files
Source: https://github.com/yigitkonur/plugin-swiftui/tree/main/plugins/swiftui/skills/audit-swiftui-sandbox-files
Command: npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-sandbox-files-yigitkonur

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ast-grep, and includes scripts (resource) and references (resource) components.

What problem does it solve? Sandboxed macOS apps fail silently at runtime when file access lacks user consent, security-scoped bookmarks, or matching entitlement keys, and AI-generated SwiftUI code routinely reproduces these iOS-shaped mistakes because the sandbox is invisible in Swift source. ## Core Features & Use Cases - Nine-rule defect index (sf-01 to sf-09): Detects arbitrary-path reads without panel consent, picked URLs persisted by path instead of security-scoped bookmarks, unbalanced startAccessingSecurityScopedResource calls, missing entitlement keys, UIPasteboard on macOS, legacy NSItemProvider drag-drop, and Hardened Runtime gaps. - Hybrid lint engine: Runs tier-1 ripgrep tells plus tier-2 ast-grep structural rules (e.g., start-without-stop inside a function body) with per-file parse probes, emitting unified JSON and SARIF output. - Evidence-grounded fixes: Verifies uncertain findings against a corpus of 1,857 shipping macOS apps via the swiftui-ctx CLI and Apple docs via Sosumi, then applies auto-fixes only for mechanical defects like UIPasteboard to NSPasteboard. - Use Case: Point it at a finished macOS SwiftUI project before App Store submission to catch the sandbox entitlement and bookmark bugs that compile cleanly but fail at runtime. ## Quick Start Audit my macOS SwiftUI project for App Sandbox file-access and entitlement problems and write the findings to swiftui-audits/sandbox-files.

Frequently Asked Questions about audit-swiftui-sandbox-files

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit a macOS SwiftUI app for App Sandbox file-access bugs?

Run the audit on your project sources; it locates candidates with a hybrid grep and ast-grep lint engine, reads each file in full, and reports only 100-percent-certain findings to swiftui-audits/sandbox-files. It checks consent, bookmarks, entitlements, drag-drop, and clipboard usage.

Why does reading a file path fail at runtime in a sandboxed macOS app?

A sandboxed app can only read its own container plus files the user grants through a system panel like fileImporter or NSOpenPanel. A literal path or URL(fileURLWithPath:) compiles fine but fails at runtime because the app was never granted access to that location.

How do I reopen a user-selected file after app relaunch on macOS?

Persist a security-scoped bookmark created with bookmarkData(options: .withSecurityScope), then resolve it with .withSecurityScope and wrap access in startAccessingSecurityScopedResource balanced by stopAccessingSecurityScopedResource via defer. Storing the path or a plain bookmark loses the permission.

Does UIPasteboard work in a native macOS SwiftUI app?

No, UIPasteboard is absent from native macOS and will not compile; only Mac Catalyst 13.1+ carries it. The macOS clipboard is NSPasteboard, and this audit auto-fixes UIPasteboard.general.string assignments to the NSPasteboard equivalent.

What are the limitations of this sandbox audit?

It is audit-only for native macOS SwiftUI, never a file-pipeline generator, and its lint scans only Swift files so entitlements and Info.plist are read manually. Only the UIPasteboard fix is automatic; entitlement and bookmark fixes are flag-only because they depend on the app's distribution model.