Repository navigation
feat(altcha): optional ALTCHA bot-protection module - #59
Merged
Merged
Conversation
New feature module spring-services-altcha (spec 023): self-hosted ALTCHA
proof of work (protocol v2) for endpoints without authentication, with no
external service and no cookies.
- AltchaService.requireVerified(payload) for the application's endpoint
- failed checks answered with 400 {"code","message"}, stable codes and an
English/German message from the request locale
- own SecurityFilterChain that permits only GET on the challenge path
- opt-in via openelements.altcha.enabled=true; start-up fails without a
hmac-key of at least 32 characters
- replaceable ReplayStore, in-memory by default
Moved from the Support & Care Check server.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: hendrikebbers <9443847+hendrikebbers@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New optional feature module
spring-services-altcha(spec 023). It protects endpoints that accept requests without authentication, such as contact, sign-up or lead forms, against automated submissions.It uses ALTCHA, a self-hosted proof of work:
It uses
org.altcha:altcha2.1.1 (MIT, protocol v2, PBKDF2/SHA-256).The module comes from the Support & Care Check server, where it protects the public check form. It was written there in the shape of a spring-services module so it could move here.
How an application uses it
The widget (
altcha3.x) fetches challenges fromGET /api/altcha/challenge. That path is configurable.Design decisions
spring-services-allconsumer without a secret would fail to start. When the module is enabled without a key of at least 32 characters, start-up fails with a clear message.SecurityFilterChain(@Order(0)), whose matcher is exactly the challenge path:GETand denies every other method thereHttpSecuritybean exists400 {"code","message"}.altcha-missing,-invalid,-expired,-reused.Accept-Language. Unknown languages get English, independent of the JVM default.ReplayStore. The default keeps used challenges in memory, which is only correct for a single instance. A shared store is listed indocs/TODO.md.@ConditionalOnMissingBeanand defined on the auto-configuration itself, as inStorageAutoConfiguration.Changes
spring-services-altcha, added to the reactor, the BOM andspring-services-all.altcha.versionis in the reactor pom.design.mdandbehaviors.md, plus an index row.docs/releases/upgrade-to-1.5.mdwritten as a consumer prompt, and a TODO entry for the shared replay store.Tests
19 tests in the module:
ReplayStoreno-storePOSTon the challenge path and other paths stay closed400body in German and English./mvnw verifypasses for the whole reactor. That includesspring-services-all's aggregate starter test, which confirms the module stays inert there.🤖 Generated with Claude Code