Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Issue 434077: Add regex escaping code to Mac sandbox implementation and re-enable the utility process on OS X. (Closed)

Created:
11 years ago by jeremy
Modified:
9 years, 6 months ago
Reviewers:
Mark Mentovai, TVL
CC:
chromium-reviews_googlegroups.com, John Grabowski
Visibility:
Public.

Description

Add regex escaping code to Mac sandbox implementation and re-enable the utility process on OS X. Other changes: * An error initializing the sandbox on OS X is now treated as fatal. * Improved error reporting for sandbox-related failures. BUG=26492, 23837 TEST=Installing extensions and themes should still work on OS X. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=33682

Patch Set 1 #

Patch Set 2 : Style fixes #

Patch Set 3 : Small fix #

Total comments: 20

Patch Set 4 : Significant changes #

Patch Set 5 : Substantial changes - ready for full review. #

Patch Set 6 : Another small fix. #

Total comments: 21

Patch Set 7 : Fix tvl's comments. #

Patch Set 8 : Fix mark's comments. #

Patch Set 9 : Append (/|$) #

Patch Set 10 : Comment fix #

Patch Set 11 : Add support for utility processes that don't need directory access. #

Patch Set 12 : Sync to trunk #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+443 lines, -29 lines) Patch
M chrome/app/chrome_dll_main.cc View 5 6 7 8 9 10 11 1 chunk +7 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_updater.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/extensions/sandboxed_extension_unpacker.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/utility.sb View 8 9 10 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/utility_process_host.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/web_resource/web_resource_service.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/sandbox_mac.mm View 1 2 3 4 5 6 7 8 9 10 6 chunks +181 lines, -14 lines 8 comments Download
A chrome/common/sandbox_mac_unittest.mm View 1 2 3 4 5 6 7 8 9 1 chunk +244 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
jeremy
Anything I should be escaping that I'm not?
11 years ago (2009-11-25 15:23:30 UTC) #1
TVL
http://codereview.chromium.org/434077/diff/2009/2015 File chrome/common/sandbox_mac.mm (right): http://codereview.chromium.org/434077/diff/2009/2015#newcode32 chrome/common/sandbox_mac.mm:32: static bool EscapeSingleChar(const CHAR c, std::string* dst) { anon ...
11 years ago (2009-11-25 15:38:07 UTC) #2
Mark Mentovai
http://codereview.chromium.org/434077/diff/2009/2014 File chrome/chrome.gyp (right): http://codereview.chromium.org/434077/diff/2009/2014#newcode4800 chrome/chrome.gyp:4800: 'common/sandbox_mac_unittest.mm', Keep this list sorted. http://codereview.chromium.org/434077/diff/2009/2015 File chrome/common/sandbox_mac.mm (right): ...
11 years ago (2009-11-25 15:45:32 UTC) #3
jeremy
I've added tests to bring the sandbox regex parser into the mix. Turns out that ...
11 years ago (2009-11-30 15:20:12 UTC) #4
Mark Mentovai
If EnableSandbox returns false, does stuff just proceed with no sandbox, or does it cause ...
11 years ago (2009-11-30 15:30:08 UTC) #5
TVL
On 2009/11/30 15:20:12, jeremy wrote: > I've added tests to bring the sandbox regex parser ...
11 years ago (2009-11-30 15:38:12 UTC) #6
TVL
On 2009/11/30 15:38:12, TVL wrote: > On 2009/11/30 15:20:12, jeremy wrote: > > I've added ...
11 years ago (2009-11-30 15:40:31 UTC) #7
jeremy
We currently only use the regex code with a temp directory path, the place where ...
11 years ago (2009-11-30 17:12:27 UTC) #8
jeremy
OK this is ready for a full review now, thanks for the feedback - to ...
11 years ago (2009-12-01 13:59:27 UTC) #9
TVL
mark had a fair number of comments in here before, so I'll let him cover ...
11 years ago (2009-12-01 14:37:33 UTC) #10
jeremy
tvl: thanks, all fixed.
11 years ago (2009-12-01 14:51:44 UTC) #11
Mark Mentovai
http://codereview.chromium.org/434077/diff/6017/5007 File chrome/app/chrome_dll_main.cc (right): http://codereview.chromium.org/434077/diff/6017/5007#newcode553 chrome/app/chrome_dll_main.cc:553: // Die if Sandbox can't be enabled. Die if ...
11 years ago (2009-12-01 15:07:32 UTC) #12
jeremy
New snapshot uploaded. On Tue, Dec 1, 2009 at 5:07 PM, <mark@chromium.org> wrote: > > ...
11 years ago (2009-12-01 15:59:14 UTC) #13
Mark Mentovai
Jeremy wrote: >> (/|$) >> >> (meaning "accept a trailing slash here and implicitly anything ...
11 years ago (2009-12-01 16:09:13 UTC) #14
jeremy
I'm not sure I understand what we gain from ending the regex with /|$ rather ...
11 years ago (2009-12-01 18:06:53 UTC) #15
Mark Mentovai
Jeremy Moskovich wrote: > I'm not sure I understand what we gain from ending the ...
11 years ago (2009-12-01 18:08:44 UTC) #16
jeremy
I stand corrected, will update the patch. On Tue, Dec 1, 2009 at 8:08 PM, ...
11 years ago (2009-12-01 18:26:42 UTC) #17
jeremy
New snapshot uploaded. (/|$) appended + updated unit tests to check this case.
11 years ago (2009-12-03 10:12:56 UTC) #18
jeremy
Turns out that for some uses of the utility process, no directory access is required. ...
11 years ago (2009-12-03 10:28:58 UTC) #19
Mark Mentovai
11 years ago (2009-12-03 14:11:25 UTC) #20
lg with a couple of minor changes.

http://codereview.chromium.org/434077/diff/14011/13009
File chrome/common/sandbox_mac.mm (right):

http://codereview.chromium.org/434077/diff/14011/13009#newcode31
chrome/common/sandbox_mac.mm:31: bool EscapeSingleChar(char c, std::string* dst)
{
I think you should only have one dst->append in this function, right before
return true.

Outside of the switch, you could have |const char* append = NULL;|, and then for
each case that wants to append something, |append = "\\b";| (or whatever).

http://codereview.chromium.org/434077/diff/14011/13009#newcode72
chrome/common/sandbox_mac.mm:72: while (position < length) {
Before entering the loop, clear dst.

http://codereview.chromium.org/434077/diff/14011/13009#newcode137
chrome/common/sandbox_mac.mm:137: dst->push_back('^');
Don't push_back.  Assign.  You want to clear out dst before you add anything to
it.

http://codereview.chromium.org/434077/diff/14011/13009#newcode165
chrome/common/sandbox_mac.mm:165: // Make sure last element of path is
interpreted as a directory, leaving this
as a directory.  Leaving this

(period and a new sentence.)

http://codereview.chromium.org/434077/diff/14011/13009#newcode271
chrome/common/sandbox_mac.mm:271: <<
base::SysNSStringToUTF8(sandbox_profile_path);
Align <<s.

http://codereview.chromium.org/434077/diff/14011/13009#newcode291
chrome/common/sandbox_mac.mm:291: PLOG(ERROR) << "Failed to resolve absolute
path error: ";
PLOG will take care of appending the error and any other stuff it needs to make
sense out of the string.  This just needs to be:

      PLOG(ERROR) << "Failed to resolve absolute path";

http://codereview.chromium.org/434077/diff/14011/13009#newcode297
chrome/common/sandbox_mac.mm:297: &allowed_dir_escaped)) {
&allowed_dir_excaped should line up with allowed_dir_absolute.

http://codereview.chromium.org/434077/diff/14011/13009#newcode342
chrome/common/sandbox_mac.mm:342: LOG_IF(ERROR, !success) << "Failed to
Initialize Sandbox: "
initialize and sandbox should be lowercase.

Powered by Google App Engine
This is Rietveld 408576698