Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Validation of email addresses via the excellent Mail gem that is available in all Rails 3 and 4 applications.
Add this line to your application's Gemfile:
gem 'validate_as_email'
And then execute:
$ bundle
Or install it yourself as:
$ gem install validate_as_email
This gem is tested against MRI, JRuby, and Rubinius using Travis CI.
You will need to be using Rails 3 or greater to make use of this validator, as it is built on top of ActiveModel, which was introduced in Rails 3.
class Person
include ActiveModel::Validations
validates_as_email :email
attr_accessor :email
end
# OR
class Person
include ActiveModel::Validations
validates :email, email: true
attr_accessor :email
end
class Person < ActiveRecord::Base
validates_as_email :email
attr_accessor :email
end
# OR
class Person < ActiveRecord::Base
validates :email, email: true
attr_accessor :email
end
The custom matcher will be loaded automatically if RSpec is loaded
first. Otherwise, you'll need to require the RSpec matcher manually
using require 'validate_as_email/rspec'
.
require 'validate_as_email/rspec'
class Person < ActiveRecord::Base
validates_as_email :email
attr_accessor :email
end
describe Person do
it { should have_a_valid_email_address_for(:email) }
it { should_not have_a_valid_email_address_for(:email) }
end
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that validate_as_email 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.