
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
rails_cloudflare_turnstile
Advanced tools
This is a Rails plugin adding support for Cloudflare Turnstile. It works with Rails 6+, and Ruby 3.x.
Add this line to your application's Gemfile:
gem 'rails_cloudflare_turnstile'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails_cloudflare_turnstile
Next, configure it by creating a config/initializers/cloudflare_turnstile.rb
with contents like the following:
RailsCloudflareTurnstile.configure do |c|
c.site_key = "XXXXXX"
c.secret_key = "XXXXXXXX"
c.fail_open = true
end
To totally disable Turnstile, you can set c.enabled = false
and all other config values are ignored.
To use Turnstile for a view:
cloudflare_turnstile_script_tag
in your layoutcloudflare_turnstile
in your form View. Keyword arguments are passed to the tag helper (for example, to set the tabindex
option, you could use cloudflare_turnstile(data: {tabindex: 0})
)validate_cloudflare_turnstile
as a before_action
in your controller.If the challenge fails, the exception RailsCloudflareTurnstile::Forbidden
will be raised; you should handle this with
a rescue_from
block.
By default, in development and test mode, a special mock view will be inserted if real credentials are not present. To
disable this, set the mock_enabled
property of the configuration to false.
The gem is available as open source under the terms of the ISC License.
FAQs
Unknown package
We found that rails_cloudflare_turnstile demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.