Skip to content

captcha: keep the navigated page as the redirect target on background requests - #162

Open
AdzerKI wants to merge 1 commit into
crowdsecurity:mainfrom
AdzerKI:captcha-return-navigation
Open

AdzerKI wants to merge 1 commit into
crowdsecurity:mainfrom
AdzerKI:captcha-return-navigation

Conversation

@AdzerKI

@AdzerKI AdzerKI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Closes #161.

Allow() stores the redirect target in captcha_<ip> on every captcha response, so a background request (service worker update, fetch) that comes before the form is posted overwrites the page the visitor navigated to, and the visitor is sent to that background URI after solving the captcha.

A request whose Sec-Fetch-Mode is set and is not navigate now keeps the URI of a pending verification. Requests without the header behave as before.

Tested in debian:latest as in nginx.yml: the new t/25_stream_captcha_background_request.t fails on main and passes with the change. The other tests give the same results with and without it; 18, 19, 20 and 24 time out in my container on main as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Captcha redirects to the last background request instead of the navigated page

1 participant