Bug 139262

Summary: Web Inspector: [Mac] Saving webarchives via Web Inspector in Safari creates files that are not double clickable
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: andersca, ap, graouts, joepeck, sam, timothy, webkit-bug-importer
Priority: P2 Keywords: DoNotImportToRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2014-12-04 11:09:23 PST
* SUMMARY
Saving webarchives with Web Inspector in Safari creates file that gets stopped by Gatekeeper when double clicked. This doesn't happen when saving a web archive from Safari itself, so this is unexpected.
Comment 1 Joseph Pecoraro 2014-12-04 11:10:17 PST
<rdar://problem/18323498>
Comment 2 Joseph Pecoraro 2014-12-04 11:18:05 PST
Created attachment 242576 [details]
[PATCH] Proposed Fix
Comment 3 Alexey Proskuryakov 2014-12-04 11:26:02 PST
Comment on attachment 242576 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=242576&action=review

> Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:63
> +static void removeQuarantinePropertiesFromFile(NSURL *path)

It seems unfortunate to have multiple copies of this non-trivial function.

> Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:383
> +        removeQuarantinePropertiesFromFile(actualURL);

This looks strange to me. If an application gets its files automatically quarantined, then can it actually remove the quarantine?
Comment 4 Joseph Pecoraro 2014-12-04 11:47:09 PST
(In reply to comment #3)
> Comment on attachment 242576 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=242576&action=review
> 
> > Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:63
> > +static void removeQuarantinePropertiesFromFile(NSURL *path)
> 
> It seems unfortunate to have multiple copies of this non-trivial function.

Yep. I considered putting this in WebCore/platform/FileSystemMac.mm. Would you prefer that?


> > Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm:383
> > +        removeQuarantinePropertiesFromFile(actualURL);
> 
> This looks strange to me. If an application gets its files automatically
> quarantined, then can it actually remove the quarantine?

I had only tested with Safari, and that was the case.

It seems anyone can remove the xattr from a file. For example:

    shell> xattr -d com.apple.quarantine /path/to/file
Comment 5 Alexey Proskuryakov 2014-12-04 12:00:55 PST
> Yep. I considered putting this in WebCore/platform/FileSystemMac.mm. Would
> you prefer that?

Yes.

> It seems anyone can remove the xattr from a file.

It's not anyone, this depends on their sandbox. A correct sandbox would normally disallow that, and I thought that AppSandbox did.
Comment 6 Joseph Pecoraro 2014-12-04 12:50:03 PST
Created attachment 242582 [details]
[PATCH] Proposed Fix

Shared the code in FileSystemMac. If there is an error removing the quarantine property it is fine to ignore it.
Comment 7 Alexey Proskuryakov 2014-12-05 15:56:26 PST
Comment on attachment 242582 [details]
[PATCH] Proposed Fix

We decided that we don't need this.