feat: implement challenge registry (#607)
* feat: implement challenge method registry This paves the way for implementing a no-js check method (#95) by making the challenge providers more generic. Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(lib/challenge): rename proof-of-work package to proofofwork Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(lib): make validated challenges a CounterVec Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(lib): annotate jwts with challenge method Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib/challenge/proofofwork): implement tests Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib): add smoke tests for known good and known bad config files Signed-off-by: Xe Iaso <me@xeiaso.net> * docs: update CHANGELOG Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(lib): use challenge.Impl#Issue when issuing challenges Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
ba4412c907
commit
f2db43ad4b
17 changed files with 480 additions and 132 deletions
9
lib/testdata/hack-test.json
vendored
Normal file
9
lib/testdata/hack-test.json
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
{
|
||||
"name": "ipv6-ula",
|
||||
"action": "ALLOW",
|
||||
"remote_addresses": [
|
||||
"fc00::/7"
|
||||
]
|
||||
}
|
||||
]
|
||||
3
lib/testdata/hack-test.yaml
vendored
Normal file
3
lib/testdata/hack-test.yaml
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
- name: well-known
|
||||
path_regex: ^/.well-known/.*$
|
||||
action: ALLOW
|
||||
8
lib/testdata/invalid-challenge-method.yaml
vendored
Normal file
8
lib/testdata/invalid-challenge-method.yaml
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
bots:
|
||||
- name: generic-bot-catchall
|
||||
user_agent_regex: (?i:bot|crawler)
|
||||
action: CHALLENGE
|
||||
challenge:
|
||||
difficulty: 16
|
||||
report_as: 4
|
||||
algorithm: hunter2 # invalid algorithm
|
||||
Loading…
Add table
Add a link
Reference in a new issue