Changelog

laravel-rust-captcha Alpha Laravel for Rust

[0.1.0] - 2026-12-04

First release, as an alpha: the API may still change before 1.0.

Added

  • A Rust port of mews/captcha 3.5.1 for Laravel for Rust: every PHP ability is covered by a test or listed as a deliberate difference in parity.toml (54 covered, 33 different).
  • Profiles with every PHP key (length, sizes, math, expire, lines, angle, backgrounds, colours, contrast, sharpen, blur, invert, sensitive, padding and margin), the five shipped profiles, and CaptchaConfig::from_php_json for a PHP config export.
  • The image route GET /captcha/{profile?} and the keyed JSON route GET /captcha/api/{profile?}.
  • The Captcha validation rule in session and keyed mode, the CaptchaManager service, the helpers src, img, issue, check and check_keyed, and the MiniJinja functions captcha_src, captcha_img and captcha_field.
  • Unicode answers are measured after case mapping, at boot and when generated.
  • Colours as PHP's Intervention Image reads them: hex, rgb(), hsl() and named colours.
  • A renderer that follows PHP's GD drawing: filters match GD within one channel unit and glyph bounds within two pixels, checked against fixtures from the real package.
  • The PHP package's fonts and backgrounds, bundled with their licences (feature bundled-assets).
  • Test helpers: testing::fix_answers, seed and seed_keyed.

Setup

  • Register CaptchaServiceProvider, and call CaptchaServiceProvider::configure_input in with_middleware, so the answer and key fields keep their raw values.
  • In production, point CAPTCHA_STORE at a shared store and set CAPTCHA_TRUST_STORE=true once its backend is verified. Laravel for Rust 0.2 can't tell the package which implementation backs a store (laravel/rust-framework#869).

Security

  • Each challenge has a random id; answers are verified with a keyed HMAC and never stored, logged, flashed as old input or sent.
  • At most one pass per challenge under concurrent submissions, with every comparison counted, tested on memory, SQLite, PostgreSQL and Redis.
  • Image requests and wrong answers are limited per client per clock minute, counted on the challenge store. Math profiles allow one to three attempts.
  • Store operations run outside the caller's database transaction and fail closed. Production refuses stores that can't give one authority: discard, failover, process-local, replicated or unverified database stores, and untrusted custom drivers.
  • captcha_img keeps only inert attributes. Input parsers were fuzzed; see design/fuzzing.md.