fix(web): embed challenge ID in pass-challenge invocations (#944)

* refactor: make challenge pages return the challenge component

This means that challenge pages will return only the little bit that
actually matters, not the entire component.

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(web): move Anubis version info to be implicitly in the footer

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(web): embed challenge ID into generated pages

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(lib): make tests pass

Signed-off-by: Xe Iaso <me@xeiaso.net>

* test(lib/policy/config): amend tests

Signed-off-by: Xe Iaso <me@xeiaso.net>

* test(lib): fix tests again

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <xe.iaso@techaro.lol>
This commit is contained in:
Xe Iaso 2025-08-04 14:49:19 -04:00 committed by GitHub
parent 790bcbe773
commit f6481b81a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 629 additions and 497 deletions

View file

@ -152,7 +152,7 @@ const t = (key) => translations[`js_${key}`] || translations[key] || key;
const t0 = Date.now();
const { hash, nonce } = await process(
{ basePrefix, version: anubisVersion },
challenge,
challenge.randomData,
rules.difficulty,
null,
(iters) => {
@ -208,6 +208,7 @@ const t = (key) => translations[`js_${key}`] || translations[key] || key;
const redir = window.location.href;
window.location.replace(
u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, {
id: challenge.id,
response: hash,
nonce,
redir,
@ -222,6 +223,7 @@ const t = (key) => translations[`js_${key}`] || translations[key] || key;
const redir = window.location.href;
window.location.replace(
u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, {
id: challenge.id,
response: hash,
nonce,
redir,