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.
activerecord-pedantmysql2-adapter
Advanced tools
ActiveRecord adapter for MySQL that report warnings.
The main usage is to progressively identify and fix MySQL warnings generated by legacy rails applications, and ultimately enable strict mode.
Alternatively it can be used to treat all MySQL warnings as errors.
Add this line to your application's Gemfile:
gem 'activerecord-pedantmysql2-adapter'
And then execute:
$ bundle
Finally in your database.yml
:
adapter: pedant_mysql2
Or if you're using DATABASE_URL
or the url key in database.yml
, you can use the pedant-mysql2
URL scheme:
url: pedant-mysql2://host/database
By default it will raise warnings as errors. But you can define any behaviour yourself in an initializer.
You can report them to your exception tracker:
PedantMysql2.on_warning = lambda { |warning| Airbrake.notify(warning) }
or totally silence them:
PedantMysql2.silence_warnings!
and to restore it to raising warnings as errors:
PedantMysql2.raise_warnings!
You can easily whitelist some types of warnings:
PedantMysql2.ignore(/Some warning I don't care about/i)
If you want to silence warnings for a limited scope, you can capture the warnings:
warnings = PedantMysql2.capture_warnings do
# perform query that may raise an error you want to stifle
end
This gem is tested to be thread safe with a couple known exceptions.
PedantMysql2.ignore
is not thread safe and should only be called during initialization of your app. Changing this within a thread while another is updating it could be problematic.
PedantMysql2.on_warning=
is not thread safe, this should also be called only during initialization.
If you find any other parts that are not thread-safe, please create an issue or PR.
Setting up the development environment is very straightforward. In order to keep the test
as simple as possible we rely on your MySQL database to have a travis
user and a
pedant_mysql2_test
database.
You can set this up easily using the following commands as your root
MySQL user:
CREATE USER 'travis'@'localhost';
CREATE DATABASE pedant_mysql2_test;
GRANT ALL PRIVILEGES ON pedant_mysql2_test.* TO 'travis'@'localhost';
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that activerecord-pedantmysql2-adapter 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.