Files
urutau/internal/core/forge_test.go
T

33 lines
1.1 KiB
Go

package core
import "testing"
func TestForgeBrowseIsNotScanner(t *testing.T) {
for _, p := range []string{
"/ciberfauna/sabia/src/commit/0123abcd/.gitignore",
"/ciberfauna/sabia/raw/commit/0123abcd/.gitignore",
"/lucasrguerra/LambdaMail/src/commit/0123abcd/.env.example",
"/ciberfauna/guara/blame/commit/0123abcd/.gitignore",
"/ciberfauna/acaua/commits/commit/0123abcd/.gitignore",
"/ciberfauna/acaua/src/branch/main/.gitignore",
"/ciberfauna/acaua/src/tag/v1.0.0/.env.example",
"/org/repo/blob/main/.gitignore",
"/org/repo/tree/main/.github/workflows",
"/group/proj/-/blob/main/.env.example",
} {
c := Classify("GET", p, 200)
if c.Cat != OK {
t.Errorf("%s: %+v", p, c)
}
}
}
func TestForgeBrowseKeepsRealProbes(t *testing.T) {
for _, p := range []string{"/.env", "/.git/config", "/app/.env", "/.gitignore", "/app/.git/config", "/x/y/.env",
"/ciberfauna/sabia/src/commit/abc/../../../.env", "/.git/src/commit/abc/x", "/a/b/src/main/.env", "/wp-config.php"} {
if c := Classify("GET", p, 200); c.Cat == OK {
t.Errorf("%s must stay a probe: %+v", p, c)
}
}
}