SwiftFormat icon indicating copy to clipboard operation
SwiftFormat copied to clipboard

Xcode source editor extension privacy alert runs on each app start

Open bryansum opened this issue 1 year ago • 4 comments

Given macOS Sequoia, each first invocation of the SwiftFormat for Xcode source editor extension (which I love!) causes a permissions alert to appear: Screenshot 2024-11-07 at 20 36 45

Was looking into this more and it seems like this might be related to something related to the shared app group container name? See https://mjtsai.com/blog/2024/09/11/group-container-names-in-sequoia/ / https://www.goldenhillsoftware.com/2024/06/migration-step-in-next-beta-of-unread-for-macos/

But looking at the source code, the shared app group container ID is com.charcoaldesign.SwiftFormat so I guess this wouldn't apply?

bryansum avatar Nov 08 '24 04:11 bryansum

Same here..

Anywhere-Music-Player avatar Nov 08 '24 14:11 Anywhere-Music-Player

You can get rid of this message by providing full disk access: image

gmoraleda avatar Nov 18 '24 11:11 gmoraleda

Does it require full disk access?

aj-pilot avatar Mar 13 '25 07:03 aj-pilot

It doesn't. It only accesses files you import. I'll take a look at the permissions and see if I can fix the warning

nicklockwood avatar Mar 13 '25 08:03 nicklockwood

I noticed when running in VS Code via https://github.com/vknabel/vscode-swiftformat there's also a lot of suspicious warnings

Add this to .vscode/extensions.json

{
    "recommendations": [
        "sswg.swift-lang",
        "vknabel.vscode-swiftformat"
    ]
} 

and then add this this to .vscode/settings.json

{
  "[swift]": {
    "editor.defaultFormatter": "vknabel.vscode-swiftformat",
    "editor.formatOnSave": true
  }
}

and restart vscode, install the extensions, then save a file, and notice swiftformat wants to access your Apple Music etc

jleaders avatar Mar 25 '25 18:03 jleaders

I've no idea why it would do that, unless somehow it's the default behavior for unsandboxed apps? (Although it's a command line app so I'm not even sure it's possible to sandbox it?)

I'm not going to be able to look into this right now - it might be worth contacting @vknabel and seeing if he has any insight into the VSCode extension permissions issue

nicklockwood avatar Mar 25 '25 20:03 nicklockwood

I'm not sure why SwiftFormat now requires full disk access; it should be clarified.

learnwithgabbar avatar Mar 27 '25 08:03 learnwithgabbar

Regarding the vscode extension, please open an issue there. PRs welcome as I am no longer into Swift nor vscode. A wild guess: the extension probably searches for any swiftformat config in the user directory and in the parent directories of the vscode workspace or the currently opened document. I remember I looked into this a few years back. Eventually I missed some edge case or did only fix it for the swiftlint extension.

vknabel avatar Mar 27 '25 09:03 vknabel