Bug 53558 - Make WebProcess pass explicit homedir parameter to the sandbox
Summary: Make WebProcess pass explicit homedir parameter to the sandbox
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-01 17:14 PST by Ivan Krstić
Modified: 2011-03-23 18:10 PDT (History)
1 user (show)

See Also:


Attachments
sandbox-homedir-path (5.74 KB, patch)
2011-02-01 17:24 PST, Ivan Krstić
mrowe: review-
Details | Formatted Diff | Diff
sandbox-homedir-path-2 (5.75 KB, patch)
2011-02-01 18:07 PST, Ivan Krstić
mjs: review+
mjs: commit-queue+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Krstić 2011-02-01 17:14:34 PST
Instead of relying on the implicit _HOME parameter for the sandbox, make WebProcess pass the parameter explicitly. This makes the sandbox behave correctly when the home directory path contains symlink elements.
Comment 1 Ivan Krstić 2011-02-01 17:24:33 PST
Created attachment 80859 [details]
sandbox-homedir-path
Comment 2 Maciej Stachowiak 2011-02-01 17:30:56 PST
Comment on attachment 80859 [details]
sandbox-homedir-path

r=me
Comment 3 Mark Rowe (bdash) 2011-02-01 17:34:46 PST
Comment on attachment 80859 [details]
sandbox-homedir-path

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

> Source/WebKit2/WebProcess/mac/WebProcessMac.mm:130
> +    if (!realpath(getenv("HOME"), homeRealPath)) {

Why are we relying on the HOME environment variable rather than using NSHomeDirectory or lower level calls to retrieve the user’s home directory?
Comment 4 Maciej Stachowiak 2011-02-01 17:36:50 PST
Mark is right, please fix that.
Comment 5 Ivan Krstić 2011-02-01 18:07:09 PST
Created attachment 80866 [details]
sandbox-homedir-path-2
Comment 6 Adam Roben (:aroben) 2011-02-02 04:58:41 PST
Comment on attachment 80866 [details]
sandbox-homedir-path-2

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

> Source/WebKit2/WebProcess/mac/WebProcessMac.mm:130
> +    if (!realpath([NSHomeDirectory() UTF8String], homeRealPath)) {

Isn't -fileSystemRepresentation more appropriate?

> Source/WebKit2/WebProcess/mac/WebProcessMac.mm:142
> +        "HOME_DIR", (const char*)homeRealPath,

I'm surprised this cast is necessary.
Comment 7 Ivan Krstić 2011-02-03 12:53:13 PST
Comment on attachment 80866 [details]
sandbox-homedir-path-2

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

>> Source/WebKit2/WebProcess/mac/WebProcessMac.mm:130

> 
> Isn't -fileSystemRepresentation more appropriate?

Not really. -fileSystemRepresentation is generally meant for normalizing programmatically-constructed paths, or making sure that derived paths remain correct during cross-volume operations. This line does neither.

>> Source/WebKit2/WebProcess/mac/WebProcessMac.mm:142
>> +        "HOME_DIR", (const char*)homeRealPath,
> 
> I'm surprised this cast is necessary.

It's not, but follows local style (see tmpRealPath, cacheRealPath below). We can eliminate all the casts in a separate patch if you'd like.
Comment 8 Maciej Stachowiak 2011-02-03 16:08:00 PST
Comment on attachment 80866 [details]
sandbox-homedir-path-2

r=me
Comment 9 WebKit Review Bot 2011-02-03 22:35:58 PST
Comment on attachment 80866 [details]
sandbox-homedir-path-2

Rejecting attachment 80866 [details] from commit-queue.

ike@apple.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 10 Ivan Krstić 2011-02-03 23:01:18 PST
Committed r77610: <http://trac.webkit.org/changeset/77610>