DescriptionAcorn 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
MessagesTotal messages: 9
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||