75Re: [caplet] Re: ADsafe, Take 3
- Oct 4, 2007No because ]]> can end a CDATA section introduced by the embedding XHTML page which would then allow the embedding script to play tricks with entities that aren't recognized by your lexer. Consider /* */ .constructor /**/ where 42 === ord('*')
Given that XHTML allows arbitrary entity definitions in DOCTYPE elements, you can't modify your lexer to recognize all entities, so if you want to restrict ADsafe JS to embeddable JS, the only thing you can do is disallow anything that looks like an entity in a pre-lexer pass.
There's a few ways to do this:
- require that the <, >, >=, >>, <<, %, &, and && operators and their self-assignment versions be separated by whitespace from other tokens
- require that characters in [<>&%] in string literals and regular expressions be hex/octal/unicode escaped
mikeOn 04/10/2007, Douglas Crockford <douglas@...> wrote:
--- In firstname.lastname@example.org, "Mike Samuel" <mikesamuel@...> wrote:
> If you do want to allow ADsafe JS to be embedded in a script tag,
> to deal with ]]> as well, since the following could be used to throw
Is it sufficient to disallow <![ ?
- << Previous post in topic Next post in topic >>