Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(690)

Issue 130052: Sandbox our Rhino runner so that we can run script under jsdoc. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 6 months ago by MikeSamuel
Modified:
16 years, 6 months ago
Reviewers:
Jasvir
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Sandbox our Rhino runner so that we can run script under jsdoc. http://codereview.appspot.com/130052 Sandboxed our JS runner using a variant of the scheme described at http://codeutopia.net/blog/2009/01/02/sandboxing-rhino-in-java/ . This will make it safer to run JSDoc as part of our build. It's pretty much a straight implementation but I disallow acces to all methods from Object.java except toString, and add some explicit checks to make sure java.lang.reflect stuff doesn't leak. Then I changed existing test code to use powerboxes instead of LiveConnect style Packages.java... A lot of work was to get env.js to run. I modified it, and locked down how it can fetch URLs. I added a <permissions> element to build.xml to limit what our unittests can do with files. Submitted @3823

Patch Set 1 #

Patch Set 2 : Sandbox our Rhino runner so that we can run script under jsdoc. #

Patch Set 3 : Sandbox our Rhino runner so that we can run script under jsdoc. #

Patch Set 4 : Sandbox our Rhino runner so that we can run script under jsdoc. #

Patch Set 5 : Sandbox our Rhino runner so that we can run script under jsdoc. #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+553 lines, -365 lines) Patch
M src/com/google/caja/plugin/PluginCompilerMain.java View 1 2 3 4 1 chunk +7 lines, -8 lines 0 comments Download
M src/com/google/caja/util/RhinoExecutor.java View 1 2 3 4 7 chunks +318 lines, -24 lines 3 comments Download
M tests/com/google/caja/AllTests.java View 1 2 3 4 3 chunks +29 lines, -26 lines 0 comments Download
M tests/com/google/caja/CajitaTest.java View 1 2 3 4 2 chunks +7 lines, -6 lines 0 comments Download
M tests/com/google/caja/demos/benchmarks/BenchmarkRunner.java View 1 2 3 4 5 chunks +12 lines, -11 lines 0 comments Download
M tests/com/google/caja/lang/css/CssPropertyPatternsTest.java View 1 2 3 4 3 chunks +3 lines, -2 lines 0 comments Download
M tests/com/google/caja/opensocial/GadgetParserTest.java View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/parser/js/JsFunFuzz.java View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M tests/com/google/caja/parser/quasiliteral/CajitaRewriterTest.java View 1 2 3 4 3 chunks +15 lines, -14 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/DefaultValijaRewriterTest.java View 1 2 3 4 5 chunks +18 lines, -17 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/InnocentCodeRewriterTest.java View 1 2 3 4 3 chunks +11 lines, -10 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/taming_test.html View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/valija_module_loading.html View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download
M tests/com/google/caja/plugin/HtmlCompiledPluginTest.java View 1 2 3 4 4 chunks +17 lines, -21 lines 0 comments Download
M tests/com/google/caja/plugin/container.js View 1 2 3 4 1 chunk +2 lines, -3 lines 0 comments Download
M tests/com/google/caja/plugin/jsunit.js View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/stages/DebuggingSymbolsStageTest.java View 1 2 3 4 3 chunks +10 lines, -10 lines 0 comments Download
M tests/com/google/caja/util/RhinoAssertsTest.java View 1 2 3 4 2 chunks +4 lines, -7 lines 0 comments Download
M tests/com/google/caja/util/RhinoTestBed.java View 1 2 3 4 6 chunks +40 lines, -90 lines 0 comments Download
M third_party/js/jqueryjs/runtest/env.js View 1 2 3 4 10 chunks +34 lines, -98 lines 0 comments Download
M third_party/js/jsunit/2.2/jsUnitCore.js View 1 2 3 4 2 chunks +15 lines, -8 lines 0 comments Download

Messages

Total messages: 5
MikeSamuel
16 years, 6 months ago (2009-10-09 23:56:18 UTC) #1
MikeSamuel
http://codereview.appspot.com/130052/diff/95/1072 File src/com/google/caja/util/RhinoExecutor.java (right): http://codereview.appspot.com/130052/diff/95/1072#newcode333 Line 333: getClass().getClassLoader().getResourceAsStream(path), "UTF-8"); I changed this to use the ...
16 years, 6 months ago (2009-10-13 19:11:51 UTC) #2
MikeSamuel
ping
16 years, 6 months ago (2009-10-20 00:57:28 UTC) #3
Jasvir
A bit of a scary CL but I don't see any other way to sandbox ...
16 years, 6 months ago (2009-10-20 06:56:24 UTC) #4
MikeSamuel
16 years, 6 months ago (2009-10-20 21:43:08 UTC) #5
http://codereview.appspot.com/130052/diff/95/1072
File src/com/google/caja/util/RhinoExecutor.java (right):

http://codereview.appspot.com/130052/diff/95/1072#newcode122
Line 122: if (fullClassName.matches("[A-Z]")) {  // is a class, not a package
On 2009/10/20 06:56:24, jasvir wrote:
> This regex misses some classes (eg jakarta regex) but its not fatal and
probably
> much quicker than the alternative.

Yep.  And a failure to distinguish a class from a package here only affects
logging, not whether something is allowed or not.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b