Skip to content

feat(lib): use new challenge creation flow#749

Merged
Xe merged 28 commits into
mainfrom
Xe/store-interface
Jul 4, 2025
Merged

feat(lib): use new challenge creation flow#749
Xe merged 28 commits into
mainfrom
Xe/store-interface

Conversation

@Xe

@Xe Xe commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Closes #564
Closes #746

Previously Anubis constructed challenge strings from request metadata. This was a good idea in spirit, but has turned out to be a very bad idea in practice. This new flow reuses the Store facility to dynamically create challenge values with completely random data.

This is a fairly big rewrite of how Anubis processes challenges. Right now it defaults to using the in-memory storage backend, but on-disk (boltdb) and valkey-based adaptors will come soon.

  • BoltDB backed store
  • Valkey backed store
  • Oh god the testing

Checklist:

  • Added a description of the changes to the [Unreleased] section of docs/docs/CHANGELOG.md
  • Added test cases to the relevant parts of the codebase
  • Ran integration tests npm run test:integration (unsupported on Windows, please use WSL)

Xe added 6 commits July 2, 2025 22:22
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Previously Anubis constructed challenge strings from request metadata.
This was a good idea in spirit, but has turned out to be a very bad idea
in practice. This new flow reuses the Store facility to dynamically
create challenge values with completely random data.

This is a fairly big rewrite of how Anubis processes challenges. Right
now it defaults to using the in-memory storage backend, but on-disk
(boltdb) and valkey-based adaptors will come soon.

Signed-off-by: Xe Iaso <me@xeiaso.net>
@Xe Xe self-assigned this Jul 3, 2025
Comment thread decaymap/decaymap.go Fixed
Comment thread lib/anubis.go Fixed
Comment thread lib/anubis.go Fixed
Comment thread lib/challenge/challengetest/challengetest.go Fixed
Comment thread lib/challenge/challengetest/challengetest.go Fixed
Comment thread lib/challenge/challengetest/challengetest.go Fixed
Comment thread lib/challenge/challengetest/challengetest_test.go Fixed
Comment thread lib/challenge/challengetest/challengetest_test.go Fixed
Comment thread lib/challenge/challengetest/challengetest_test.go Fixed
Xe added 3 commits July 3, 2025 04:07
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Comment thread lib/anubis.go Fixed
Comment thread lib/anubis.go Fixed
Comment thread lib/store/memory/memory_test.go Fixed
Comment thread lib/store/memory/memory_test.go Fixed
Comment thread lib/store/storetest/storetest.go Fixed
Comment thread lib/store/storetest/storetest.go Fixed
Comment thread lib/store/storetest/storetest.go Fixed
Xe added 2 commits July 3, 2025 00:46
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/store/bbolt/bbolt_test.go Fixed
Comment thread lib/store/bbolt/bbolt_test.go Fixed
Comment thread lib/store/bbolt/factory.go Fixed
Comment thread lib/store/bbolt/factory_test.go Fixed
Comment thread lib/store/bbolt/factory_test.go Fixed
Xe added 4 commits July 3, 2025 18:05
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
@Xe Xe force-pushed the Xe/store-interface branch from f2423c2 to 1138770 Compare July 4, 2025 18:30
Signed-off-by: Xe Iaso <me@xeiaso.net>
@Xe Xe force-pushed the Xe/store-interface branch from 1138770 to 3808f7b Compare July 4, 2025 18:31
Comment thread .devcontainer/docker-compose.yaml Fixed
Comment thread .devcontainer/docker-compose.yaml Fixed
Comment thread lib/store/all/all.go Fixed
Comment thread lib/store/valkey/factory.go Fixed
Comment thread lib/store/valkey/factory.go Fixed
Comment thread lib/store/valkey/valkey.go Fixed
Comment thread lib/store/valkey/valkey.go Fixed
Comment thread lib/store/valkey/valkey.go Fixed
Comment thread lib/store/valkey/valkey_test.go Fixed
Comment thread lib/store/valkey/valkey_test.go Fixed
Xe added 2 commits July 4, 2025 18:38
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Comment thread internal/unbreakdocker.go Fixed
Comment thread internal/unbreakdocker.go Fixed
Comment thread internal/unbreakdocker.go Fixed
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/policy/config/store_test.go Fixed
Comment thread lib/store/valkey/valkey_test.go Fixed
check-spelling run (pull_request) for Xe/store-interface

Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com>
on-behalf-of: @check-spelling <check-spelling-bot@check-spelling.dev>
Xe added 6 commits July 4, 2025 19:34
…t for you

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

Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
Comment thread docs/docs/admin/policies.mdx Fixed
Comment thread docs/docs/admin/policies.mdx Dismissed
Xe added 2 commits July 4, 2025 19:55
Signed-off-by: Xe Iaso <me@xeiaso.net>
Signed-off-by: Xe Iaso <me@xeiaso.net>
@Xe Xe enabled auto-merge (squash) July 4, 2025 20:38
@Xe Xe merged commit dff2176 into main Jul 4, 2025
7 checks passed
Xe added a commit that referenced this pull request Aug 20, 2025
Closes #1002

TL;DR: challenge IDs were not validated at time of token issuance. A
dedicated attacker could solve a challenge once and reuse it across
multiple sessons in order to mint additional tokens.

With the advent of store based challenge issuance in #749, this means
that these challenge IDs are only good for 30 minutes. Websites using
the most recent version of Anubis have limited exposure to this problem.

Websites using older versions of Anubis have a much more increased
exposure to this problem and are encouraged to keep this software
updated as often and as frequently as possible.
Xe added a commit that referenced this pull request Aug 20, 2025
* fix(lib): ensure issued challenges don't get double-spent

Closes #1002

TL;DR: challenge IDs were not validated at time of token issuance. A
dedicated attacker could solve a challenge once and reuse it across
multiple sessons in order to mint additional tokens.

With the advent of store based challenge issuance in #749, this means
that these challenge IDs are only good for 30 minutes. Websites using
the most recent version of Anubis have limited exposure to this problem.

Websites using older versions of Anubis have a much more increased
exposure to this problem and are encouraged to keep this software
updated as often and as frequently as possible.

* docs: update CHANGELOG

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

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
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.

Internal hash is sometimes incorrect "invalid response." after "Success!" in Chromium

2 participants