[whatwg] idea about html code security anti xss

gabmeyer at westweb.at gabmeyer at westweb.at
Wed Jun 16 04:33:11 PDT 2010

On 6/15/10 6:19 PM, gabmeyer at westweb.at wrote:

 I had just this idea after reading so much about xss and code injection.

 I think there is a simple solution:

 I now invent an attribute called strlen=""

 I append this to ahtmlcode with strlen of 94843 bytes including whitespace

 The browser know knows the exact position where the divtag must end.

 You cannot inject some code that closes the tag before.

 you can now control the code inside the div.
 you can also append a second attribute called "secure" that prevents any scriptcode to run from inside the div.

 Maybe this idea is not new, or does not work.

 Please let me know what you think about this idea.

 Christian Gabmeyer

On 2010-06-16 03:29:50 arun at mozilla.com wrote:    

I think one approach that we're interested in pursuing at Mozilla is the 
Content Security Policy approach:


In particular, restrictions on inline scripts, or at least on 'eval' 
might be useful here, along with other mitigation on loading cross-site 

We'd like this in the Firefox 4 timeframe.

-- A*

Hello Arun
CSP: This seams to affect only the whole document, because it uses a header to switch browser into secure mode. but from a htmlcoder  point this is not the place where i work. everybody should be able to write secure code not only the developer, i think.

my aproach to be able to define a strlen attribute gives the browser the ability to check for broken/closing tags, and in case of an injection inside the string it must ignore the foreign closing tag .
If i put all unsecure code into sections of <div unsecure="strlen in bytes"></div> it is posible for the browser to render the page correctly and than apply CSP to it.
on the server side the developer must not know the content or even inspect it the only thing todo is run strlen() around it and create the tag surrounding the content.

-- C*

More information about the whatwg mailing list