Extended attributes

25 Feb 2018


And I’m sure I’ve bumped into it before, but today I got confused all over again, so I’m writing it down so I know where to look the next time I get confused.

I had problems with a webpage which couldn’t load a javascript file – the server gave me a 403 (forbidden) status code.

The command ls -l shows

-rwxr-xr-x@   1 bronwen  staff  22691 24 Feb 19:17 jquery.validate.min.js

and the @ sign means that the file has extended attributes

Run ls -l@ to see the extended attributes

-rwxr-xr-x@   1 bronwen  staff  46285 24 Feb 19:17 jquery.validate.js
        com.apple.quarantine       26

The com.apple.quarantine extended attributes are part of the file quarantine feature that Apple added yonks ago (OS X Leopard – 2009?). From the release notes for OS X Leopard

File Quarantine is a new feature in Leopard designed to protect users from trojan horse attacks. It allows applications which download file content from the Internet to place files in “quarantine” to indicate that the file could be from an untrustworthy source. An application quarantines a file simply by assigning values to one or more quarantine properties which preserve information about when and where the file come from.

To remove the file from quarantine:

xattr -d com.apple.quarantine *

And to remove ALL FILES in the folder from quarantine:

find . -iname '*.js' -print0 | xargs -0 xattr -d com.apple.quarantine