dom_test.go 444 B

12345678910111213141516
  1. package dom
  2. import (
  3. "strings"
  4. "testing"
  5. )
  6. func TestScriptArgumentsAreJSONEncoded(t *testing.T) {
  7. s := Script("read", map[string]string{"value": "\"});globalThis.attack=true;//\u2028"})
  8. if !strings.Contains(s, `\"});globalThis.attack=true;//\u2028`) {
  9. t.Fatal("argument was not encoded as data")
  10. }
  11. if !strings.Contains(source, "NodeFilter.SHOW_ELEMENT") || !strings.Contains(source, "4000") {
  12. t.Fatal("bounded walker missing")
  13. }
  14. }