Bug 156799 - File URLs should be passed through 'fileSystemRepresentation' before use
Summary: File URLs should be passed through 'fileSystemRepresentation' before use
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-20 11:32 PDT by Brent Fulgham
Modified: 2016-04-22 14:02 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2016-04-20 11:32:39 PDT
We need to audit WebKit code to make sure that we always call fileSystemRepresentation before using a URL path as a file system path, and ideally make the compiler check that for us.
Comment 1 Brent Fulgham 2016-04-20 11:56:57 PDT
It looks the following places need to be changed:

Internals::createFile
WebProcessProxy::hasAssumedReadAccessToURL
WebProcessProxy::checkURLReceivedFromWebProcess
WebPageProxy::loadFile

I think the point of fileSystemRepresentation is to ensure that the path is compatible with POSIX APIs. Are there reasons why we might want to deal with non-POSIX paths inside WebKit, up until the point where we actually pass them off to POSIX routines?
Comment 2 Brent Fulgham 2016-04-22 14:02:43 PDT
I reviewed the various places where a file path is retrieved from a URL. It looks like in all cases we call fileSystemRepresentation on the path (or hand it to a function that in turn calls fileSystemRepresentation on its argument).

The two places in WebProcessProxy that use the method do so to retrieve a string for later use in comparing with a path. Since that paths in both places are retrieved without calling fileSystemRepresentation, it seemed better to leave these unmodified since the extra conversion wouldn't provide any additional safety, but would incur a runtime penalty.