Skip to content

Commit 47fa543

Browse files
committed
Fix FP textarea test (to no longer fire XSS)
1 parent 3e53b12 commit 47fa543

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

transform.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func init() {
104104
trMap[TagsOff] = ReplaceFunction(RemoveTags)
105105
trMap[TagsOffExceptTextareaClose] = ReplaceFunction(RemoveTagsExceptTextareaClose)
106106
trMap[TagsOffUntilTextareaClose] = ReplaceFunction(RemoveTagsUntilTextareaClose)
107-
trMap[TextareaCloseOff] = NewRegexpMatchEraser(`(?i)</(textarea[^>]*)>`)
107+
trMap[TextareaCloseOff] = ReplaceFunction(removeTextareaClose)
108108
trMap[TextareaSafe] = ReplaceFunction(ReplaceTextareaSafe)
109109
}
110110

@@ -271,6 +271,12 @@ func ReplaceTextareaSafe(src string) (out string) {
271271
return out
272272
}
273273

274+
func removeTextareaClose(in string) (out string) {
275+
re := regexp.MustCompile(`(?i)(</textarea\s*>)`)
276+
out = re.ReplaceAllLiteralString(in, "")
277+
return
278+
}
279+
274280
func backslashDoublequotes(in string) (out string) {
275281
for _, r := range in {
276282
switch r {

0 commit comments

Comments
 (0)