Fix keep challenge

This commit is contained in:
Pascal Engélibert 2025-04-06 18:05:47 +02:00
commit af9e46c714
2 changed files with 14 additions and 8 deletions

View file

@ -36,6 +36,6 @@ policy-groups:
- name: robots.txt - name: robots.txt
first-line: "^GET /robots.txt " first-line: "^GET /robots.txt "
action: allow action: allow
- name: Favicon - name: Test
first-line: "^GET /favicon.ico " first-line: "^GET /test/[a-z]+/"
action: allow action: challenge

View file

@ -143,10 +143,9 @@ async fn main() {
} }
} }
let mut allow = false;
let mut valid_challenge = false; let mut valid_challenge = false;
let mut allow = false;
if let (Some(req_challenge), Some(req_proof)) = (req_challenge, req_proof) { if let Some(req_challenge) = req_challenge {
valid_challenge = challenge::verify_challenge_cookie( valid_challenge = challenge::verify_challenge_cookie(
req_challenge, req_challenge,
&secret, &secret,
@ -154,8 +153,15 @@ async fn main() {
req_ip, req_ip,
config.challenge_timeout, config.challenge_timeout,
); );
allow = valid_challenge
&& challenge::check_challenge(req_challenge, req_proof, TARGET_ZEROS); if let Some(req_proof) = req_proof {
allow = valid_challenge
&& challenge::check_challenge(
req_challenge,
req_proof,
TARGET_ZEROS,
);
}
} }
if allow { if allow {