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

Issue 19560044: Reject, in the mitigator, JS reserved names written with escapes, to avoid misinterpretation. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 4 months ago by kpreid2
Modified:
12 years, 3 months ago
Reviewers:
MarkM, Jasvir
CC:
caja-discuss-undisclosed_googlegroups.com, MarkM, felix8a, ihab.awad, metaweta, MikeSamuel
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Acorn and escodegen are inconsistent in their handling of program text like de\u006Cete (an escaped reserved word). Acorn parses it as an identifier and unescapes it, but escodegen takes the resulting parse tree node and renders it as "delete", thus changing the interpretation of the program. Furthermore, JS implementations also differ in their interpretation of an escaped reserved word; therefore, we cannot even make this necessarily safe by changing the code generator. Fix this by rejecting all programs which we parse and which contain identifiers which match reserved words (except for positions where reserved words are allowed such as "foo.de\u006Cete"). Fixes <https://code.google.com/p/google-caja/issues/detail?id=1867>. While attempting to fix this problem, I ran into issues with upgrading Acorn and escodegen. Supporting changes to help future such effort: * Run SES mitigation tests with minified source as well as unminified. * Add a test for an apparent undiagnosed bug in our minifier which causes the mitigator to mangle regexp literals if minified. Other supporting changes: * test-ses-mitigation.html uses createExports.js/exportsToSES.js instead of custom glue. * Normalized indentation of test cases in test-ses-mitigation.js. * The mitigator now passes through the specific error message from errors thrown while parsing. @r5630

Patch Set 1 #

Total comments: 12

Patch Set 2 : Reject, in the mitigator, JS reserved names written with escapes, to avoid misinterpretation. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+201 lines, -73 lines) Patch
M build.xml View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/com/google/caja/ses/exportsToSES.js View 1 chunk +1 line, -0 lines 0 comments Download
M src/com/google/caja/ses/mitigateGotchas.js View 1 5 chunks +77 lines, -6 lines 1 comment Download
M tests/com/google/caja/ses/ses-tests.json View 1 chunk +10 lines, -1 line 0 comments Download
M tests/com/google/caja/ses/test-ses-mitigation.html View 1 1 chunk +13 lines, -14 lines 0 comments Download
M tests/com/google/caja/ses/test-ses-mitigation.js View 1 1 chunk +90 lines, -37 lines 0 comments Download
A + tests/com/google/caja/ses/test-ses-mitigation-min.html View 1 chunk +9 lines, -15 lines 0 comments Download

Messages

Total messages: 9
kpreid2
12 years, 4 months ago (2013-10-29 23:36:18 UTC) #1
MarkM
https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js File src/com/google/caja/ses/mitigateGotchas.js (right): https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js#newcode128 src/com/google/caja/ses/mitigateGotchas.js:128: var table = {}; Since we're now willing to ...
12 years, 4 months ago (2013-10-30 01:16:31 UTC) #2
MarkM
https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js File src/com/google/caja/ses/mitigateGotchas.js (right): https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js#newcode37 src/com/google/caja/ses/mitigateGotchas.js:37: // There is a bug or undefined behavior which ...
12 years, 4 months ago (2013-10-30 13:31:33 UTC) #3
kpreid2
https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js File src/com/google/caja/ses/mitigateGotchas.js (right): https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js#newcode37 src/com/google/caja/ses/mitigateGotchas.js:37: // There is a bug or undefined behavior which ...
12 years, 4 months ago (2013-10-30 18:41:55 UTC) #4
kpreid2
Acorn and escodegen are inconsistent in their handling of program text like de\u006Cete (an escaped ...
12 years, 4 months ago (2013-10-30 18:44:15 UTC) #5
MarkM
LGTM https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js File src/com/google/caja/ses/mitigateGotchas.js (right): https://codereview.appspot.com/19560044/diff/1/src/com/google/caja/ses/mitigateGotchas.js#newcode451 src/com/google/caja/ses/mitigateGotchas.js:451: // "Error {}" so we use the explicit ...
12 years, 4 months ago (2013-10-30 18:52:55 UTC) #6
kpreid2
Thanks, MarkM. Ihab?
12 years, 4 months ago (2013-10-30 19:00:30 UTC) #7
Jasvir
LGTM with the fixes.
12 years, 4 months ago (2013-10-30 19:44:46 UTC) #8
kpreid2
12 years, 4 months ago (2013-10-30 19:47:21 UTC) #9
On 2013/10/30 19:44:46, Jasvir wrote:
> LGTM with the fixes.

Okay, this is hereby an undisclosed security patch ready to go.
Sign in to reply to this message.

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