fix(server): drop unwired Altcha gate on duel start_game (412 on shared links)#60
Merged
Conversation
The duel branch of start_game was gated on an Altcha PoW solution that the front never produced — every shared duel link returned 412 Precondition Failed when the friend clicked 'Play this grid'. The remaining protections are sufficient for the abuse vectors we actually face: - tower_governor rate-limit (1 req/250ms per device, 60/min per IP) - play_token HMAC bound to (game_id, device_id, started_at) - UNIQUE (grid_id, device_id) — one game per device per grid - duel share URLs HMAC-signed (duel_sig), grid_id unforgeable Keep altcha::* and the Redis replay-guard infra in place so a future re-enable is a one-flag change. Just stop forcing it on a flow that has no widget to satisfy it.
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
Every shared duel link returned 412 Precondition Failed when the friend clicked "Play this grid" — `POST /api/games` rejected the body for a missing Altcha solution.
Why
The duel branch of `start_game` was gated on an Altcha PoW that the front never wired:
```rust
let altcha_required = matches!(mode, GameMode::Duel);
if altcha_required {
let solution = body.altcha_solution.as_deref()
.ok_or(ApiError::AltchaRequired)?; // ← every duel
}
```
The existing comment even said "The Altcha widget will be re-introduced on the front when we expose duel creation" — we exposed it in #55/#59 but never reintroduced the widget, so the gate was killing the flow.
The remaining protections are enough for realistic abuse:
How
Strip the gate from `start_game`, drop the now-unused imports (`crate::altcha`, `crate::services::altcha as altcha_service`). The infrastructure stays: `altcha::decode_solution`, `verify_solution`, `guard_replay` on Redis — re-enabling per-mode is a one-flag change if we ever see spam signals.
Checklist
Test plan