ambethia/recaptcha
62.4
Adequate · 19 September 2026
1.2k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a Ruby gem that provides integration helpers for Google's reCAPTCHA v2, v3, and Enterprise APIs. It offers a modern, configuration-driven architecture with dedicated adapters for Rails and Sinatra, enabling developers to render verification tags and validate user responses. The library includes comprehensive view helpers, controller verification methods, and robust error handling for score-based and challenge-based authentication flows.
Features
Add Sinatra demo application for reCAPTCHA verification
A new demo application has been added in the demo/sinatra directory, providing a working example of integrating reCAPTCHA with the Sinatra web framework. The included server.rb file demonstrates how to configure site and secret keys, render reCAPTCHA tags in a form, and verify user responses on the backend.
demo/sinatra · high confidence
Added User model example in demo Rails app
A new User model file has been added to the demo Rails application, providing a basic ActiveRecord::Base class structure as a reference example.
recaptcha · high confidence
Rails demo app adds v3 support with v2 fallback and multiple usage examples
The Rails demo application now includes comprehensive examples for reCAPTCHA v3, featuring a new V3CaptchasController and views that demonstrate single-action verification, multi-action verification, custom JavaScript callbacks, and executing verification on form submit. A key addition is the v3-to-v2 fallback pattern, which automatically presents a v2 checkbox challenge if the v3 score is below the configured threshold. The demo also retains and clarifies v2 examples, including invisible reCAPTCHA support and multi-widget setups, and provides a User model example to show model-based verification.
demo/rails · high confidence
Removals
Removed empty ReCAPTCHA rake task
The placeholder Rake task for ReCAPTCHA has been removed from the project. This cleanup eliminates an unused file that contained only commented-out code, streamlining the task namespace.
tasks · high confidence
Behavioural changes
Major architectural refactor and reCAPTCHA v2/v3 support
The library has been completely rewritten from the legacy Ambethia namespace to a modern Recaptcha module, introducing support for reCAPTCHA v2 and v3 as well as reCAPTCHA Enterprise. This change replaces the previous controller-based validation with a new configuration-driven architecture, separating concerns into dedicated adapters for controller and view methods. Users will now interact with a centralized configuration object, can pass options like private keys and timeouts directly to verification methods, and benefit from improved error handling via a new Reply class and specific VerifyError exceptions. The diff also shows the removal of the old hardcoded API servers in favor of configurable URLs and the addition of JSON POST support for verification requests.
lib · high confidence
Rails demo app scaffolded with version 5.2 configuration defaults
The demo application in demo/rails/config has been initialized with a standard Rails 5.2 project structure, including environment-specific configurations for development, test, and production, as well as initializers for assets, cookies, and session management. The setup explicitly loads Rails 5.0 defaults while providing the new\_framework\_defaults\_5\_2 initializer to guide the migration to 5.2 behaviors, and configures the application to use SQLite for the database and Redis for Action Cable in production.
demo/rails/config · high confidence
ReCAPTCHA gem updated to v5.21.2 with configuration and v3 support
The lib/recaptcha gem has been updated to version 5.21.2. This release introduces a new \Recaptcha::Configuration\ class that centralizes settings such as site/secret keys, proxy settings, and API URLs, allowing configuration via \Recaptcha.configure\ or environment variables. It adds support for reCAPTCHA v3, including view helpers for generating v3 tags and handling actions, and introduces a \Recaptcha::Reply\ class to handle verification responses with support for enterprise features like hostname validation and score thresholds. The update also includes improvements to timeout handling and error messages.
lib/recaptcha · high confidence
Refactored reCAPTCHA adapters with v3 support and improved error handling
The reCAPTCHA library has been refactored to extract adapter logic into dedicated modules, introducing explicit support for reCAPTCHA v3 alongside existing v2 options. Controllers now expose the reCAPTCHA reply and failure reason, providing users with detailed error messages (such as score thresholds or API errors) rather than generic failures. Additionally, flash messages are now supported for Turbo Stream requests, and the parameter name for v3 responses has been updated to 'g-recaptcha-response-data' to distinguish it from v2.
lib/recaptcha/adapters · high confidence
Repository modernization and RuboCop configuration
The project has been modernized by introducing a RuboCop configuration file (.rubocop.yml) targeting Ruby 3.0, updating the Rakefile to use Bundler and run RuboCop by default, and adding a .gitignore file to exclude generated documentation and demo lockfiles. Legacy plugin hooks (init.rb, install.rb, uninstall.rb) have been removed, and the documentation has been consolidated into a new README.md with a table of contents, replacing the old README file.
(repo-wide) · high confidence
Test coverage
Added comprehensive test suite for reCAPTCHA view helpers, configuration, and controller verification
This change introduces a new, structured test suite for the reCAPTCHA library, replacing the legacy test/unit-based tests with a modern Minitest/Maixmest framework. The new tests cover client helper view methods (including \recaptcha\_tags\ and \invisible\_recaptcha\_tags\), verifying that HTML attributes like \id\, \tabindex\, \nonce\, \data-expired-callback\, and \data-error-callback\ are rendered correctly, and that options like \script: false\ or \turbolinks: true\ behave as expected. It also adds tests for the \Recaptcha::Configuration\ class, ensuring that \api\_server\_url\, \verify\_url\, and block-based configuration overrides work correctly for both free and enterprise APIs. Finally, it includes extensive controller helper tests for \verify\_recaptcha\ and \verify\_recaptcha!\, covering success/failure scenarios, error handling, I18n translation of error messages, timeout handling, and validation of response lengths and remote IPs.
test · high confidence
Dependencies
Initial release of the recaptcha gem (v5.21.2) with Ruby 3.0+ support
This change introduces the recaptcha gem, providing helpers for the reCAPTCHA API, with a minimum requirement of Ruby 3.0.0. The package includes a Gemfile and gemspec that define development dependencies such as rubocop, mocha, webmock, and i18n, alongside demo applications for Rails 5.2 and Sinatra to illustrate integration.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 62.
Lenses
- Code Health 98
- Architecture 69
- Maturity 61
- Readiness 54
- Security 74
- Domain Modelling 100
Changes since last survey
- 300 commits — 273 feature/other, 27 fixes
By area
- (root) — 119 commits
- (repo) — 83 commits
- lib/recaptcha — 57 commits
- lib/recaptcha.rb — 13 commits
- demo/rails — 7 commits
- rails/locales — 4 commits
- test/client_helper_test.rb — 4 commits
- test/verify_test.rb — 4 commits
- .github/workflows — 3 commits
- test/verify_enterprise_test.rb — 3 commits
- test/configuration_test.rb — 2 commits
- test/helper.rb — 1 commit
Notable commits
- fix: Add metadata URIs for bug tracker and changelog
- fix: Fix accessor for score value for reCaptcha Enterprise
- fix: Fix changelog tag
- fix: Fix docs for hCaptcha response limit
- fix: Fix enterprise_verify_url
- fix: Fix example of v2 fallback
- fix: Fix execute on submit demo example
- fix: Fix japanese locale
- fix: Fix skip_env? to fall back to Rails.env when default_env is nil
- fix: Fix specs
- fix: Fix to_json method to accept arguments
- fix: Little fixes to the README
- fix: Merge pull request #334 from maalur/default-timeout-bugfix
- fix: Merge pull request #382 from Vin0uz/fix-typo-fr-locale
- fix: Merge pull request #395 from AMHOL/fix/handle-invalid-params
- fix: Merge pull request #404 from theirix/hcaptcha-fix-docs
- fix: Merge pull request #415 from yuh-pen/fearure/fix-enterprise-verify-url
- fix: Merge pull request #419 from yujideveloper/fix/japanese-locale
- fix: Merge pull request #464 from ambethia/grosser/fix
- fix: Merge pull request #476 from duncantmiller/fix/skip-env-reliability-in-multithreaded-test-servers
- …and 280 more
Architecture
- 0 containers · 1 bounded contexts · 0 dependency edges (baseline)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ambethia/recaptcha was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 3fadd21a0b122157e08b924cce4bdea6e4e94003 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.