Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
This project rocks and uses MIT-LICENSE.
You can easily test this gem by:
test/dummy
directoryrails s
http://localhost:3000/cielo_assets
Add this gem to your Gemfile:
gem 'cielo_assets'
Call cielo_controls
helper method at your view:
<%= cielo_controls :my_object, :field %>
This generates the following markup:
<div class="horizontal" id="cielo_controls">
<input id="my_object_field_amex" name="my_object[field]" type="radio" value="amex">
<label class="amex" for="my_object_field_amex">Amex</label>
<input id="my_object_field_diners" name="my_object[field]" type="radio" value="diners">
<label class="diners" for="my_object_field_diners">Diners</label>
<input id="my_object_field_elo" name="my_object[field]" type="radio" value="elo">
<label class="elo" for="my_object_field_elo">Elo</label>
<input id="my_object_field_mastercard" name="my_object[field]" type="radio" value="mastercard">
<label class="mastercard" for="my_object_field_mastercard">Mastercard</label>
<input id="my_object_field_mastercard_securecode" name="my_object[field]" type="radio" value="mastercard_securecode">
<label class="mastercard_securecode" for="my_object_field_mastercard_securecode">Mastercard securecode</label>
<input id="my_object_field_verified_by_visa" name="my_object[field]" type="radio" value="verified_by_visa">
<label class="verified_by_visa" for="my_object_field_verified_by_visa">Verified by visa</label>
<input id="my_object_field_visa" name="my_object[field]" type="radio" value="visa">
<label class="visa" for="my_object_field_visa">Visa</label>
</div>
To provide basic styles, just require cielo_assets at your manifest:
/*
* ...
*
*= require cielo_assets
*
* ...
*/
There are two basic styles available: Vertical and Horizontal.
See their definitions at app/assets/stylesheets/cielo_assets/controls.css.scss
.
Switching between styles can be done by providing the css class name as the second argument to the helper:
<%= cielo_controls :my_object, :field, style: :vertical %>
This only changes the container class:
<div class="vertical" id="cielo_controls">
...
</div>
You can provide any arbitrary css class since you define it at your own application.
<%= form_for :my_object do |f| %>
<%= f.cielo_controls :field %>
<%= f.submit %>
<% end %>
When rails fields fails to validate, the corresponding field is surrounded by a div with field_with_errors class. This breaks CieloAssets behavior, because it expects input and labels are adjacent, to highlight the checked control:
input {
display: none;
&:checked + label {
border-color: #777;
}
}
To avoid this side effect, add
this workaround
on your project's config/application.rb
:
config.action_view.field_error_proc = Proc.new { |html_tag, instance|
if instance.object.respond_to? "disable_field_with_errors_for_#{instance.method_name}"
html_tag.html_safe
else
"<div class=\"field_with_errors\">#{html_tag}</div>".html_safe
end
}
and declare the fields (via attr_reader or an empty method, for example)
that should not be surrounded by field_with_errors
div when validation fails:
# supposes attribute is named cielo_flag
attr_accessible :cielo_flag
attr_reader :disable_field_with_errors_for_cielo_flag
or
# supposes attribute is named flag
attr_accessible :flag
def disable_field_with_errors_for_flag
end
FAQs
Unknown package
We found that cielo_assets 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 malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.