Xcode 15: SwiftLint file-read errors when ENABLE_USER_SCRIPT_SANDBOXING = YES
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
Xcode 15 beta adds a recommendation popup that the user should enable USER_SCRIPT_SANDBOXING to detect dependency issues. With ENABLE_USER_SCRIPT_SANDBOXING = YES, the build fails on several files that SwiftLint tries to scan, but can't access when running in a sandbox. These files are obviously not Swift code: myProj.xcodeproj, .git, .gitignore, and files with string localisations (*.lproj).
Version details
SwiftLint 0.52.2
Xcode 15 beta (14E300b) that came online during Apple's 2023 WWDC event.
Xcode 15 beta brings Swift 5.9 (5.9.0.114.6)
SwiftLint installed and upgraded to 0.52.2 using brew in Mac terminal
MacOS Ventura 13.4
Workarounds to avoid the error
ENABLE_USER_SCRIPT_SANDBOXING = NO- I doubt I can fully avoid this by
excludein the .swiftlint.yml file (because that excludes directories, not files?)
Xcode error message (for my project)
Sandbox: swiftlint(10747) deny(1) file-read-data /<path>/<projectname>/<projectname> UITests
Sandbox: swiftlint(10747) deny(1) file-read-data /<path>/<projectname>/.github
Sandbox: swiftlint(10747) deny(1) file-read-data /<path>/<projectname>/nl.lproj (same for en.lproj)
Sandbox: swiftlint(10747) deny(1) file-read-data /<path>/<projectname>/.git
Sandbox: swiftlint(10747) deny(1) file-read-data /<path>/<projectname>/<projectname>.xcodeproj
The list of offending files varies a bit (probably due to incomplete/incremental compilation).
Reproducible in any project?
Haven't tried to create a "Hello World" project that is on GitHub. The .git and .github files and .xcodeproj files should do the trick. I may confirm this myself. But, if I am right, the majority of the users of the Xcode 15 beta (users of git in some form) who also use SwiftLint should run into this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with ENABLE_USER_SCRIPT_SANDBOXING = YES in an Xcode project containing .git, .github, .lproj, and .xcodeproj entries, then trace SwiftLint's file scanning behavior. Review the available .swiftlint.yml exclusion behavior and verify that linting no longer produces sandbox read errors for non-Swift files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100