-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quarantine attribute to downloads #22388
Comments
I mentioned this in the linked malware PR, but we might be able to use the spctl command to manually check the app? It returns a non-zero exit code if there's something wrong with an app. > spctl -a /Applications/Amazon\ Music.app
/Applications/Amazon Music.app: a sealed resource is missing or invalid Might be something worth looking into. |
Issue with that approach is what to do after checking the app. Simply outputting a message is insufficient. That also puts the responsibility on us. What we want is to defer the responsibility to Apple (they have much better resources and the solution is theirs, after all). |
http://stackoverflow.com/questions/21591485/using-xattr-to-set-the-mac-osx-quarantine-property
|
@joshka: The quarantine flag is composed of a UUID, however, which the system keeps a record of, even when the flag is removed afterwards. Duplicating this en masse could lead to problems at some point, but who knows. The quarantine flag is set automatically by applications that adopt the LSFileQuarantineEnabled property in the info.plist file, which applications like Safari seem to be doing. The functionality can also be provided through the Core Services framework, by adding the attributes. There is some background information about the content of the flag in this, albeit old, blog post: http://ilostmynotes.blogspot.co.uk/2012/06/gatekeeper-xprotect-and-quarantine.html. |
@joshka Yes, I found that method as well, but I’d like for this to be correct. When you try to open a quarantined file, the GUI dialog tells you where and when it came from. Breaking that is not desirable. |
yep - fair call :) |
Ok, I got it working. I think you don't actually need to set Read
Set
Read
Set
Read
Set
Insert UUID into Database
Check if UUID exists in Database
|
@reitermarkus: I think you are correct about Do you think that the UUID has to be checked for uniqueness in the database? |
Great work, @reitermarkus! Thank you. I’ll defer to your opinion regarding if Do you have any idea what the Could we in theory have On another note, just to clarify (realised now I hadn’t), the |
For us, only 0002 is relevant:
One thing I haven't tested yet is if unpacking an archive via Terminal preserves/sets the attribute on the extracted Application. |
And yes, Although, I tried this with a file downloaded with Safari, and the database field before |
Ok, I found that an entry in the database has these fields:
|
Yes, good catch. Added a check to my post above. |
@reitermarkus You’re really on to something. Instead of adding this logic to HBC directly, would it be sensible to perhaps abstract this to a |
@vitorgalvao, I started something here: https://github.com/reitermarkus/quarantine |
@reitermarkus Really interesting read. Added it to the top post. |
Are there any news on this? I've checked @reitermarkus's work and can confirm it quarantines apps successfully. |
Thanks for picking this up @amyspark! Something I'm not sure about is the While it is accurate and matches the output of Also in some cases the "Show Web Page" won't open a website (or if it does it won't be relevant to the Cask). It might be better to use the Downloaded from the homepage which redirects to the same cloudfront download Edit: Is it possible to use the full homepage URL? |
Gatekeeper only works when the
com.apple.quarantine
is set, which is quite frankly ridiculous and makes the feature incredibly less useful. It also means no HBC user is covered by it, sincecurl
does not set the attribute.My suggestion:
com.apple.quarantine
attribute automatically to all downloaded files.--no-quarantine
flag that won’t add the attribute.Problems / things that need to checked:
com.apple.quarantine
true, and it needs to have actual values that we need to understand how to set.@reitermarkus is doing great research on this.
The text was updated successfully, but these errors were encountered: