You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This leaves out = and &, which are also commonly escaped in this context.
This is not a vulnerability as & and = can only create problems when they appear in HTML context.
That said I would assume that it is not uncommon to have inline event handlers like these:
<buttononclick=%s> click me! </button>
in which people forget to also apply HTML escaping after JS escaping when doing "manual" escaping instead of using html/template.
We should probably approach this in a more conservative way and err on the side of escaping a little bit more than less, hence adding two more characters to the escape set.
Note that this change might break some tests if they rely on stored responses.
This was reported by a finder via [email protected]
text/template.JSEscape escapes 5 characters in the "safe" printable ascii, plus all characters considered risky.
Current code to check if a rune needs escaping:
This leaves out
=
and&
, which are also commonly escaped in this context.This is not a vulnerability as
&
and=
can only create problems when they appear in HTML context.That said I would assume that it is not uncommon to have inline event handlers like these:
in which people forget to also apply HTML escaping after JS escaping when doing "manual" escaping instead of using html/template.
We should probably approach this in a more conservative way and err on the side of escaping a little bit more than less, hence adding two more characters to the escape set.
Note that this change might break some tests if they rely on stored responses.
CL: https://go-review.googlesource.com/c/go/+/207637
cc @FiloSottile @rsc @mvdan @t1ddl3r
The text was updated successfully, but these errors were encountered: