Commit 94e9a5e1 authored by Roberto Clapis's avatar Roberto Clapis Committed by Filippo Valsorda
Browse files

text/template: harden JSEscape to also escape ampersand and equal

Ampersand and equal are not dangerous in a JS/JSString context
but they might cause issues if interpolated in HTML attributes.

This change makes it harder to introduce XSS by misusing
escaping.

Thanks to t1ddl3r <t1ddl3r@gmail.com> for reporting this common
misuse scenario.

Fixes #35665

Change-Id: Ice6416477bba4cb2ba2fe2cfdc20e027957255c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/207637


Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
Reviewed-by: default avatarMike Samuel <mikesamuel@gmail.com>
Reviewed-by: default avatarAndrew Bonventre <andybons@golang.org>
Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
parent f4a8bf12
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment