RESOLVED FIXED 55371
[Mac, WK2] Properly canonicalize paths for sandbox extensions
https://bugs.webkit.org/show_bug.cgi?id=55371
Summary [Mac, WK2] Properly canonicalize paths for sandbox extensions
Ivan Krstić
Reported 2011-02-28 06:21:15 PST
Since Sandbox operates on VFS paths, NSString -stringByStandardizingPath and -fileSystemRepresentation are not appropriate methods for canonicalization.
Attachments
patch (2.45 KB, patch)
2011-02-28 06:22 PST, Ivan Krstić
darin: review+
Ivan Krstić
Comment 1 2011-02-28 06:22:03 PST
Darin Adler
Comment 2 2011-02-28 11:05:30 PST
Comment on attachment 84051 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=84051&action=review > Source/WebKit2/Shared/mac/SandboxExtensionMac.mm:115 > - NSString *standardizedPath = [(NSString *)path stringByStandardizingPath]; > - handle.m_sandboxExtension = WKSandboxExtensionCreate([standardizedPath fileSystemRepresentation], wkSandboxExtensionType(type)); > + char normalizedPath[PATH_MAX]; > + if (!realpath(path.utf8().data(), normalizedPath)) > + return; Adding the call to realpath seems fine. I believe that’s the primary intention of this patch. But I’m surprised that it’s correct to convert to UTF-8 explicitly rather than using the fileSystemRepresentation method. Previously we had been told that it was always better to use that method and not do the UTF-8 conversion ourselves.
Darin Adler
Comment 3 2011-06-18 11:29:34 PDT
This patch was never landed. Do we want this change or not?
Eric Seidel (no email)
Comment 4 2011-06-18 13:40:27 PDT
Attachment 84051 [details] was posted by a committer and has review+, assigning to Ivan Krsti\u0107 for commit.
Alexey Proskuryakov
Comment 5 2013-03-16 22:49:21 PDT
We now call realpath (indirectly) in SandboxExtension::createHandle(). We don't in SandboxExtension::createHandleForTemporaryFile(), and I'm not exactly sure why it works without. But since it does, I don't see a reason to keep this bug open.
Note You need to log in before you can comment on or make changes to this bug.