summaryrefslogtreecommitdiffstats
path: root/modules/markup/sanitizer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/sanitizer_test.go')
-rw-r--r--modules/markup/sanitizer_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/markup/sanitizer_test.go b/modules/markup/sanitizer_test.go
index 63b70166d8..9e173015d6 100644
--- a/modules/markup/sanitizer_test.go
+++ b/modules/markup/sanitizer_test.go
@@ -6,6 +6,8 @@
package markup
import (
+ "html/template"
+ "strings"
"testing"
"github.com/stretchr/testify/assert"
@@ -50,3 +52,13 @@ func Test_Sanitizer(t *testing.T) {
assert.Equal(t, testCases[i+1], string(SanitizeBytes([]byte(testCases[i]))))
}
}
+
+func TestSanitizeNonEscape(t *testing.T) {
+ descStr := "<scrİpt>&lt;script&gt;alert(document.domain)&lt;/script&gt;</scrİpt>"
+
+ output := template.HTML(Sanitize(string(descStr)))
+ if strings.Contains(string(output), "<script>") {
+ t.Errorf("un-escaped <script> in output: %q", output)
+ }
+
+}