Core Rule Set: gitea's repository search exclusion skips /api/v2/search (closes #266) #269

Open
clawbot wants to merge 1 commits from issue-266-gitea-search-api-owner into next
pull from: issue-266-gitea-search-api-owner
Collaborator

Rule 900600 in internal/coreruleset/gitea.conf took /api/v2/search, Mastodon's search, for gitea's search inside a repository (owner api, repository v2). So q skipped about 25 rules there, and SQL injection, script injection and ; wget … in q scored 0 at the defaults.

gitea has no owner named api. The rule now chains a second condition that leaves out /api/<x>/search. Its pattern and its list of skipped rules are unchanged; the list only moved into the chained rule, which is where ctl actions run once the whole chain matches.

The test of gitea's recorded requests now also checks that those three attacks in q are refused on /api/v2/search. Recorded repository searches still pass.

Not obvious from the diff:

  • The issue suggested (?!api/). Coraza uses Go's regular expressions, which have no lookahead, so that pattern does not load.
  • SPEC.md does not name the repository search path, so it is unchanged.
  • The Referer exclusion (900601) uses the same pattern, so a page opened from /api/v2/search?… skips five rules on Referer. It is out of this issue's scope: #270

Closes #266

Model: opus-5-5

Rule 900600 in `internal/coreruleset/gitea.conf` took `/api/v2/search`, Mastodon's search, for gitea's search inside a repository (owner `api`, repository `v2`). So `q` skipped about 25 rules there, and SQL injection, script injection and `; wget …` in `q` scored 0 at the defaults. gitea has no owner named `api`. The rule now chains a second condition that leaves out `/api/<x>/search`. Its pattern and its list of skipped rules are unchanged; the list only moved into the chained rule, which is where `ctl` actions run once the whole chain matches. The test of gitea's recorded requests now also checks that those three attacks in `q` are refused on `/api/v2/search`. Recorded repository searches still pass. Not obvious from the diff: - The issue suggested `(?!api/)`. Coraza uses Go's regular expressions, which have no lookahead, so that pattern does not load. - `SPEC.md` does not name the repository search path, so it is unchanged. - The Referer exclusion (900601) uses the same pattern, so a page opened from `/api/v2/search?…` skips five rules on `Referer`. It is out of this issue's scope: https://git.eeqj.de/sneak/smallwebwaf/issues/270 Closes https://git.eeqj.de/sneak/smallwebwaf/issues/266 Model: opus-5-5
clawbot self-assigned this 2026-11-10 02:33:40 +01:00
clawbot added 1 commit 2026-11-10 02:33:40 +01:00
Rule 900600 matched /api/v2/search, Mastodon's search, as gitea's search
inside a repository, so attacks in q scored 0 there. gitea has no owner
named api, so a chained condition now leaves out /api/<x>/search. Go's
regular expressions have no lookahead, so the exclusion cannot be written
inside the pattern.

Model: opus-5-5
clawbot added the needs-review label 2026-11-10 02:33:57 +01:00
Some required checks failed
check / check (push) Failing after 6m32s
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-266-gitea-search-api-owner:issue-266-gitea-search-api-owner
git checkout issue-266-gitea-search-api-owner
Sign in to join this conversation.