{"id":800,"date":"2020-01-07T06:21:09","date_gmt":"2020-01-07T11:21:09","guid":{"rendered":"https:\/\/www.brunerd.com\/blog\/?p=800"},"modified":"2021-02-28T09:33:16","modified_gmt":"2021-02-28T14:33:16","slug":"track-and-tackle-com-apple-macl","status":"publish","type":"post","link":"https:\/\/www.brunerd.com\/blog\/2020\/01\/07\/track-and-tackle-com-apple-macl\/","title":{"rendered":"Track and Tackle  com.apple.macl"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>UPDATE:<\/strong> As of Big Sur (macOS 11) the <strong>com.apple.macl<\/strong> extended attribute can be removed using: <code>xattr -rd com.apple.macl &lt;file\/folder><\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Starting in macOS Catalina, an extended attribute (XA) named <strong>com.apple.macl<\/strong> is being added to the files and folder you  work with. What does it do? How does it work? When does it get added? Where is the documentation?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All these are good questions, but there&#8217;s no official documentation. A good start is <a rel=\"noreferrer noopener\" aria-label=\"this assemblage (opens in a new tab)\" href=\"https:\/\/mjtsai.com\/blog\/2019\/12\/18\/persistent-file-access-via-com-apple-macl-xattr\/\" target=\"_blank\">this assemblage<\/a> of articles, here&#8217;s the highlights from that page and a few more&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Apple talked about this vaguely in their WWDC 2019 session 701, &#8220;<a rel=\"noreferrer noopener\" aria-label=\"Advances in macOS Security (opens in a new tab)\" href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2019\/701\/\" target=\"_blank\">Advances in macOS Security<\/a>&#8220;, the Files and Folders fun starts at 21:21 but there&#8217;s nothing really about the implementation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tom Bridge <a rel=\"noreferrer noopener\" aria-label=\"talks about (opens in a new tab)\" href=\"https:\/\/youtu.be\/IXnT-ibTLk8?t=1235\" target=\"_blank\">talked about<\/a> com.apple.macl to the Penn State Macadmins back in August before Catalina&#8217;s release. He&#8217;s one of the first to notice this XA (and talk about it). Although, he says that <code>curl<\/code> will add this XA to downloads, it thankfully does <em>not<\/em>. Most likely it happened when he dragged it to Terminal or performed some other action on it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Howard Oakley of the prolific Eclectic Light Company blog <a rel=\"noreferrer noopener\" aria-label=\"kicks the tires (opens in a new tab)\" href=\"https:\/\/eclecticlight.co\/2019\/12\/20\/opening-documents-sip-and-quarantine-flags-in-catalina\/\" target=\"_blank\">kicks the tires<\/a> a bit more and finds some interesting quirks, as he always does.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Jeff Johnson though, really <a href=\"https:\/\/lapcatsoftware.com\/articles\/macl.html\">hits the nail on the head<\/a> in illustrating what&#8217;s going on when you simply drag and drop a file or folder into Terminal and com.apple.macl is appended. He dropped this, December 18th and well&#8230; the holidays were around the corner and we all had better stuff to do!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s 2020 now and time to come back around to this. A <a rel=\"noreferrer noopener\" aria-label=\"very helpful post (opens in a new tab)\" href=\"https:\/\/forums.developer.apple.com\/thread\/124121\" target=\"_blank\">very helpful post<\/a> in the Apple Dev forums from an Apple employee, Quinn &#8220;the Eskimo&#8221;, decodes the data structure a bit more as well as what some of the conditions for having this XA appended are:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>When a user selects a \u201cprotected\u201d file or folder in an NSOpenPanel in a non-sandboxed app on Catalina, consent is inferred and the app can access it.<br>&#8230;<br>It seems that 01 00 is a header of some form and &#8230; is a UUID associated with my test app.&nbsp; I dug into how that UUID is set up and, well, <strong>it\u2019s complex, and more of an implementation detail than I care to go into here on DevForums.<\/strong><\/p><cite>https:\/\/forums.developer.apple.com\/thread\/124121<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Well, I would have loved the complex implementation detail! But I&#8217;ll tell you this: <span style=\"text-decoration: underline;\">The app UUID in com.apple.macl is unique to EVERY computer<\/span>. Jeff Johnson was right when he said: &#8220;<a rel=\"noreferrer noopener\" aria-label=\"The macl is effectively untraceable (opens in a new tab)\" href=\"https:\/\/twitter.com\/lapcatsoftware\/status\/1208014254177226753\" target=\"_blank\">The macl is effectively untraceable<\/a>&#8220;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However you can begin to see the shape of things when you write a tool to output the UUID in CSV like I have. Behold <a href=\"https:\/\/gist.github.com\/brunerd\/8bbf9ba66b2a7787e1a6658816f3ad3b\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"maclTrack.command (opens in a new tab)\">maclTrack.command<\/a><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/brunerd\/8bbf9ba66b2a7787e1a6658816f3ad3b.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">Run it in Terminal, give it files or folders as arguments, it&#8217;ll report on them, you can even specify a maximum depth for folders (-d) and silence reporting on items lacking com.apple.macl (-s), pipe it into tee to see the output and write it to a file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"844\" height=\"348\" src=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/macTrack-help.png\" alt=\"\" class=\"wp-image-819\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/macTrack-help.png 844w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/macTrack-help-300x124.png 300w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/macTrack-help-768x317.png 768w\" sizes=\"auto, (max-width: 844px) 100vw, 844px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"866\" height=\"960\" src=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTest5-1.png\" alt=\"\" class=\"wp-image-818\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTest5-1.png 866w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTest5-1-271x300.png 271w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTest5-1-768x851.png 768w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><figcaption>This poor file got clobbered by multiple app UUIDs<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Something interesting I noticed from using this tool is seeing the &#8220;Header&#8221; as <a href=\"https:\/\/forums.developer.apple.com\/thread\/124121\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Quinn called it (opens in a new tab)\">Quinn called it<\/a>, differ from 0100 to 0200. I believe 0200 is for drag and drop operations vs. a regular save which results in 0100.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Again, the app UUIDs you see on the files on your Mac will <em>never<\/em> be seen on another Mac <em>ever<\/em> &#8211; why? Because UUIDs are meant to be truly unique. Have you <em>read<\/em> the man page for uuidgen? They ain&#8217;t eff&#8217;in around!<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;The uuidgen command generates a Universally Unique IDentifier (UUID), a 128-bit value <strong>guaranteed to be unique over both space and time.<\/strong><\/p><cite>Apple man page for uuidgen<\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">So what&#8217;s the point of having a long lived XA that <span style=\"text-decoration: underline;\">you can&#8217;t get rid of<\/span> and that&#8217;s only useful on your local Mac? If it&#8217;s a permissions <em>granting<\/em> XA (the <em>opposite<\/em> of com.apple.quarantine which imposes <em>restrictions<\/em>) then why not let the user remove it? In some ways it&#8217;s a cross computer file tracking mechanism, albeit &#8220;anonymized&#8221;. Perhaps allowing it&#8217;s removal though (aka writing &#8220;nothing&#8221; to the XA) also allows for <em>something to <\/em>be written? This is where I could get in trouble speculating, it&#8217;s just a guess.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Perhaps you&#8217;ll forgive me that, since I <em>have<\/em> found a way to clear com.apple.macl without disabling SIP! Zip it. No, not the one spawned Finder&#8217;s &#8220;Compress&#8221; menu item, I mean <code>\/usr\/bin\/zip<\/code>! I noticed command line zip would obliterate XAs during a project many years ago and it <em>still does<\/em> my friends! So behold <a href=\"https:\/\/gist.github.com\/brunerd\/d9ea487b7d2faab9712a221592a2ee58\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"maclTackle.command (opens in a new tab)\">maclTackle.command<\/a><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/brunerd\/d9ea487b7d2faab9712a221592a2ee58.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">This script has considerably less engineering to it because it&#8217;s a PoC and I&#8217;m really don&#8217;t want to take responsibility for something going awry should you try to clear com.apple.macl on your entire Desktop folder (no I <em>haven&#8217;t<\/em> tested that). But it will strip the XAs off a file that&#8217;s for sure! NOTE: USE A NON-IMPORTANT FILE with this script (make a duplicate). The script will <span style=\"text-decoration: underline;\">overwrite the original<\/span> (don&#8217;t like the behavior? It&#8217;s a script: Comment it out!)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"404\" src=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTackle.png\" alt=\"\" class=\"wp-image-821\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTackle.png 748w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/maclTackle-300x162.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><figcaption>\ud83c\udfb6 Gonna wash that macl right outta my file&#8230; \ud83c\udfb6<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Apple may come along and close this loophole now that it&#8217;s been pointed out or perhaps they <em>won&#8217;t<\/em> since they&#8217;d have to <a rel=\"noreferrer noopener\" aria-label=\"publish the modfication (opens in a new tab)\" href=\"https:\/\/opensource.apple.com\/source\/zip\/zip-16\/\" target=\"_blank\">publish the modfication<\/a>? Perhaps they&#8217;ll continue to purge &#8220;undesirable&#8221; binaries from macOS? They say they <a rel=\"noreferrer noopener\" aria-label=\"will stop shipping Python, perl and ruby in macOS (opens in a new tab)\" href=\"https:\/\/developer.apple.com\/documentation\/macos_release_notes\/macos_catalina_10_15_release_notes#3318257\" target=\"_blank\"><em>will<\/em> stop shipping Python, perl and ruby in macOS<\/a> <em>some<\/em> day and you know what <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/opensource.apple.com\/source\/python_modules\/python_modules-46.200.1\/Modules\/xattr-0.6.4\/rtool.py.in.auto.html\" target=\"_blank\">xattr<\/a> is written in? That&#8217;s right Python! \u00af\\_(\u30c4)_\/\u00af<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Alright, come and get it while the gettin&#8217;s good! Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: As of Big Sur (macOS 11) the com.apple.macl extended attribute can be removed using: xattr -rd com.apple.macl &lt;file\/folder> Starting in macOS Catalina, an extended attribute (XA) named com.apple.macl is being added to the files and folder you work with. What does it do? How does it work? When does it get added? Where is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,19,12,8],"tags":[],"class_list":["post-800","post","type-post","status-publish","format-standard","hentry","category-apple","category-bash","category-scripting","category-security"],"_links":{"self":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/comments?post=800"}],"version-history":[{"count":10,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/800\/revisions"}],"predecessor-version":[{"id":942,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/800\/revisions\/942"}],"wp:attachment":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/media?parent=800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/categories?post=800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/tags?post=800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}