aboutsummaryrefslogtreecommitdiff
path: root/lib/policy/config/testdata
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-04-20 20:09:27 -0400
committerGitHub <noreply@github.com>2025-04-21 00:09:27 +0000
commitd40b5cfdab11c62dc2ed226bde32b19ea7107f21 (patch)
tree2c997fd907c0de22e98b1ab6dc233141e10567e1 /lib/policy/config/testdata
parent022eb59ff337427ae4fe151fd1f24ec411418479 (diff)
downloadanubis-d40b5cfdab11c62dc2ed226bde32b19ea7107f21.tar.xz
anubis-d40b5cfdab11c62dc2ed226bde32b19ea7107f21.zip
lib: move config to yaml (#307)
* lib: move config to yaml Signed-off-by: Xe Iaso <me@xeiaso.net> * web: run go generate Signed-off-by: Xe Iaso <me@xeiaso.net> * Add Haiku to known instances (#304) Signed-off-by: Asmodeus <46908100+AsmodeumX@users.noreply.github.com> * Add headers bot rule (#300) * Closes #291: add headers support to bot policy rules * Fix config validator * update docs for JSON -> YAML Signed-off-by: Xe Iaso <me@xeiaso.net> * docs: document http header based actions Signed-off-by: Xe Iaso <me@xeiaso.net> * lib: add missing test Signed-off-by: Xe Iaso <me@xeiaso.net> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Signed-off-by: Asmodeus <46908100+AsmodeumX@users.noreply.github.com> Co-authored-by: Asmodeus <46908100+AsmodeumX@users.noreply.github.com> Co-authored-by: Neur0toxine <pashok9825@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'lib/policy/config/testdata')
-rw-r--r--lib/policy/config/testdata/bad/badregexes.yaml7
-rw-r--r--lib/policy/config/testdata/bad/invalid.yaml1
-rw-r--r--lib/policy/config/testdata/bad/nobots.yaml1
-rw-r--r--lib/policy/config/testdata/good/allow_everyone.yaml6
-rw-r--r--lib/policy/config/testdata/good/block_cf_workers.yaml5
-rw-r--r--lib/policy/config/testdata/good/challengemozilla.yaml4
-rw-r--r--lib/policy/config/testdata/good/everything_blocked.yaml4
7 files changed, 28 insertions, 0 deletions
diff --git a/lib/policy/config/testdata/bad/badregexes.yaml b/lib/policy/config/testdata/bad/badregexes.yaml
new file mode 100644
index 0000000..3880e40
--- /dev/null
+++ b/lib/policy/config/testdata/bad/badregexes.yaml
@@ -0,0 +1,7 @@
+bots:
+- name: path-bad
+ path_regex: "a(b"
+ action: DENY
+- name: user-agent-bad
+ user_agent_regex: "a(b"
+ action: DENY \ No newline at end of file
diff --git a/lib/policy/config/testdata/bad/invalid.yaml b/lib/policy/config/testdata/bad/invalid.yaml
new file mode 100644
index 0000000..18625b6
--- /dev/null
+++ b/lib/policy/config/testdata/bad/invalid.yaml
@@ -0,0 +1 @@
+bots: [] \ No newline at end of file
diff --git a/lib/policy/config/testdata/bad/nobots.yaml b/lib/policy/config/testdata/bad/nobots.yaml
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/lib/policy/config/testdata/bad/nobots.yaml
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/lib/policy/config/testdata/good/allow_everyone.yaml b/lib/policy/config/testdata/good/allow_everyone.yaml
new file mode 100644
index 0000000..5c49534
--- /dev/null
+++ b/lib/policy/config/testdata/good/allow_everyone.yaml
@@ -0,0 +1,6 @@
+bots:
+- name: everyones-invited
+ remote_addresses:
+ - "0.0.0.0/0"
+ - "::/0"
+ action: ALLOW \ No newline at end of file
diff --git a/lib/policy/config/testdata/good/block_cf_workers.yaml b/lib/policy/config/testdata/good/block_cf_workers.yaml
new file mode 100644
index 0000000..c66bade
--- /dev/null
+++ b/lib/policy/config/testdata/good/block_cf_workers.yaml
@@ -0,0 +1,5 @@
+bots:
+ - name: cloudflare-workers
+ headers_regex:
+ CF-Worker: .*
+ action: DENY \ No newline at end of file
diff --git a/lib/policy/config/testdata/good/challengemozilla.yaml b/lib/policy/config/testdata/good/challengemozilla.yaml
new file mode 100644
index 0000000..15922b0
--- /dev/null
+++ b/lib/policy/config/testdata/good/challengemozilla.yaml
@@ -0,0 +1,4 @@
+bots:
+- name: generic-browser
+ user_agent_regex: Mozilla
+ action: CHALLENGE \ No newline at end of file
diff --git a/lib/policy/config/testdata/good/everything_blocked.yaml b/lib/policy/config/testdata/good/everything_blocked.yaml
new file mode 100644
index 0000000..323c596
--- /dev/null
+++ b/lib/policy/config/testdata/good/everything_blocked.yaml
@@ -0,0 +1,4 @@
+bots:
+- name: everything
+ user_agent_regex: .*
+ action: DENY