core: rework request rules

fixes #21
This commit is contained in:
Vaxry
2025-04-21 20:13:24 +01:00
parent cd0fadf952
commit f199569ff8
7 changed files with 139 additions and 99 deletions

View File

@@ -26,17 +26,24 @@
// NOT recommended to set to anything below 4 or above 5.
"default_challenge_difficulty": 4,
// specific ip range configs.
"ip_configs": [
// specific rules. They are checked top to bottom, and the first one to match will determine the request's fate
"rules": [
{
"action": "ALLOW",
"ip_ranges": [
"127.0.0.1/24",
"::1/128"
],
// if this regex matches the resource requested, a different rule will be applied
"exclude_regex": ".*/commit/.*",
"action_on_exclude": "DENY"
]
}, {
"action": "DENY",
"user_agent": ".*(bot).*"
}, {
"action": "DENY",
"resource": "(/secret/).*"
}, {
"action": "CHALLENGE",
"difficulty": 5, // quite damn hard!
"resource": "(/hard/).*"
}
],