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.
routes_lazy_routes is an evil Rails plugin that defers loading the whole bloody routes until the server gets the first request, so the app can spin up quickly. 🤘
This voodoo gem is designed especially for you who are maintaining a huge legacy Rails app that contains hundreds of routes that forces you to wait dozens of seconds per every rails
command invocation.
Add this line to your application's Gemfile:
gem 'routes_lazy_routes'
If you're not brave enough, you can limit the group not to include production
environment.
Indeed, enabling this gem for the processes like batch or job may improve their runtime performance, but so far as that's not a critical problem for your production system, the following setup might be safer.
group :development, :test do
gem 'routes_lazy_routes'
end
You have nothing to do with it. It should just work beneath the skin.
The first visitor of the server should sacrifice their time for the Rails process to load the routes. First strike is deadly. If you're bundling this in the production server, it'd be a good idea to throw a jab to the server right after the deployment in order to warm up before accepting real client requests.
You can manually eager_load the routes by calling RoutesLazyRoutes.eager_load!
(the "load runner").
Rails.application.eager_load!
automatically invokes RoutesLazyRoutes.eager_load!
since that should be what we expect for Rails.application.eager_load!
.
Loading an integration test automatically kicks RoutesLazyRoutes.eager_load!
since AD::Integration expects the routes to be loaded.
And, as already explained, sending a request to the Rails server automatically runs RoutesLazyRoutes.eager_load!
on the server.
On the other hand, you need manually calling RoutesLazyRoutes.eager_load!
inside your worker process (e.g. Sidekiq) to resolve named routes like the following:
# config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
if defined?(RoutesLazyRoutes)
Rails.application.config.after_initialize do
RoutesLazyRoutes.eager_load!
end
end
end
Patches are welcome on GitHub at https://github.com/amatsuda/routes_lazy_routes.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that routes_lazy_routes 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.
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.