Core Rule Set: Forgejo's searches at a branch or tag, of releases and of job logs pass (closes #350)
check / check (push) Waiting to run
check / check (push) Waiting to run
`testdata/forgejo-requests.txt` records these Forgejo 17.0.1 searches with the hard values, file names and plain words. `forgejo.conf` lets them through: - the code search at a branch or tag, where the home page's search box sends its search without a code indexer: `q` skips what it skips on gitea's code search; - the release search, page and API: `q` skips 930120, 932120, 932160, 932250 and 932260, since it matches tag names; - the job log search in the API: the same, without 932160. In `gitea.conf`, `q` on the branch and package searches also skips 932160, so `/bin/sh` passes there. `SPEC.md` lists both. Model: opus-5-5
This commit is contained in:
1 parent
b6aa2cbc4b
commit
e57255b728
5 files changed
+182
-12
No files matched your search
@@ -6,13 +6,18 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// forgejoSearches are Forgejo's searches whose q skips some rules: the
|
||||
// wiki's, from the fifteenth change, and the searches for a name, from the
|
||||
// eighth.
|
||||
// forgejoSearches are Forgejo's searches whose q skips some rules: those of
|
||||
// a wiki, of releases and of a job's log, from the fifteenth change, and the
|
||||
// searches for a name, from the eighth. The search of code at a branch or tag
|
||||
// is not one of them: there, as on gitea's search of code, q lets these
|
||||
// attacks through.
|
||||
//
|
||||
//nolint:gochecknoglobals // a constant cannot be a list
|
||||
var forgejoSearches = []string{
|
||||
"/alice/tools/wiki/search",
|
||||
"/alice/tools/releases",
|
||||
"/api/v1/repos/alice/tools/releases",
|
||||
"/api/v1/repos/alice/tools/actions/jobs/1/logs",
|
||||
"/explore/repos",
|
||||
"/explore/users",
|
||||
"/alice/tools/branches",
|
||||
@@ -58,16 +63,33 @@ func TestForgejoExclusionsAreNarrow(t *testing.T) {
|
||||
|
||||
crs := atDefaults(t)
|
||||
|
||||
// /bin/sh and the hard values, which q lets through on the wiki's
|
||||
// search, stay refused in q on paths near it and in another field on it.
|
||||
// /bin/sh and the hard values, which q lets through on the searches of
|
||||
// the fifteenth change and on those of branches and packages, stay
|
||||
// refused in q on paths near them and in another field on them.
|
||||
// /alice/wiki/search would be the code search of a repository named
|
||||
// wiki, where the eighth change lets q through. Forgejo has no owner
|
||||
// named api, so /api/wiki/search is not one.
|
||||
// named api, so the paths under /api/ here are not searches.
|
||||
for _, target := range []string{
|
||||
"/alice/tools/wiki/Home?q=",
|
||||
"/alice/tools/wiki/search/x?q=",
|
||||
"/api/wiki/search?q=",
|
||||
"/alice/tools/wiki/search?other=",
|
||||
"/alice/tools/search/branch?q=",
|
||||
"/alice/tools/search/commit/0123abc?q=",
|
||||
"/alice/tools/src/branch/main?q=",
|
||||
"/api/tools/search/branch/main?q=",
|
||||
"/alice/tools/search/branch/main?other=",
|
||||
"/alice/tools/releases/tag/v1.0?q=",
|
||||
"/alice/tools/releases/latest?q=",
|
||||
"/api/v1/releases?q=",
|
||||
"/alice/tools/releases?other=",
|
||||
"/api/v1/repos/alice/tools/actions/jobs/1?q=",
|
||||
"/api/v1/repos/alice/tools/actions/runs/1/logs?q=",
|
||||
"/alice/tools/actions/runs/1/jobs/0/logs?q=",
|
||||
"/api/v1/repos/alice/tools/actions/jobs/1/logs?other=",
|
||||
"/alice/tools/branches/x?q=",
|
||||
"/alice/-/packages/npm/x?q=",
|
||||
"/alice/tools/branches?other=",
|
||||
} {
|
||||
for _, value := range slices.Concat([]string{"%2Fbin%2Fsh"}, hardValues) {
|
||||
if got := inspect(t, crs, get(target+value)); got.Score < threshold {
|
||||
|
||||
Reference in new issue
Block a user