
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Easy to use classic captcha for Rails apps
Configurable via DSL
Supports caching
Simple, Easy to use
Uses Imagemagick via the MiniMagick gem
Add this line to your application's Gemfile:
gem 'captcher'
And then execute:
$ bundle
Or install it yourself as:
$ gem install captcher
Mount the engine inside your application by adding this line to your application's routes file at config/routes.rb
:
mount Captcher::Engine => "/captcher"
class ApplicationController < ActionController::Base
include Captcher::CaptchaAware
end
class MyController < ApplicationController
def index
reload_captcha # Reload the captcha
# render response with success code ...
end
def create
@comment = Comment.new(comment_params)
captcha_check = confirm_captcha?(params[:captcha])
if @comment.valid? && captcha_check && @comment.save
# render response with success code ...
else
@comment.errors[:captcha] << "Captcha verification failed" unless captcha_check
# render response with error code ...
end
end
# ... some other code
end
<%= simple_form_for(some_form) do |f| %>
<!-- Some html/erb code for all form fields -->
<!-- ... -->
<!-- /Some html/erb code for all form fields -->
<div class="input-group">
<%= text_field_tag :captcha, "",
type: :text,
label: false,
class: "form-control",
placeholder: "Enter the captcha" %>
<div class="input-group-append">
<div class="input-group-text" style="padding: 0">
<%= image_tag(captcher.captcha_path(format: :png), style: "height: 35px;",
id: "captcha-image") %>
</div>
<button class="btn btn-outline-secondary" type="button" id="captcha-reload">
<i class="fa fa-refresh"></i>
</button>
</div>
</div>
<% end %>
function reloadCaptcha() {
$.ajax({
type: 'GET',
url: '/captcher/captcha/reload.png',
success: function() {
var timestamp = (new Date()).getTime();
$('#captcha-image').attr("src", "/captcher/captcha.png?" + timestamp);
},
});
}
$('#captcha-reload').click(function() {
reloadCaptcha();
});
These endpoints are available by default (as soon as you've mounted the Captcher
engine to your routes.rb
file) and can be used for some async requests:
http://your-application.com/captcher/captcha
- Load the captcha image
http://your-application.com/captcher/captcha/reload
- Reload the captcha
http://your-application.com/captcher/captcha/confirm?confirmation=code
- Confirm captcha code
Select one of the following available modes:
code_captcha - Classic image-based captcha;
cached_captcha - Acts like a caching proxy for any of available captcha types.
Keeps several generated captcha variants in cache. The number of available cache slots is configured with the slots_count
parameter
math_captcha (not implemented yet)
awesome_captcha (not implemented yet)
# config/initialiers/captcher.rb
Captcher.configure do |c|
c.mode = :cached_captcha
c.code_captcha do |cc|
cc.fonts Dir[Captcher::Engine.root.join("lib/fonts/**")]
cc.font_size 50
cc.font_color "black"
cc.count 5
cc.background "#999999"
cc.format "png"
end
c.cached_captcha do |cc|
cc.slots_count 10
cc.wrapped :code_captcha
end
end
Implement some other types of captcha
Integrate with Travis to test the gem against different versions of Ruby/ROR
Improve code style
Improve documentation
Autogenerated API documentation
Add some caching
Contribution directions go here.
The fonts wich are shiped by default with this repo are taken from https://github.com/google/fonts and use the SIL Open Font License, v1.1
There's a list of the origin paths of the fonts:
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that captcher demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.