
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
To improve fragment caching efficiency in Rails by only caching the things that change. Use this gem after you have configured as much in-memory caching as possible using standard techniques such as Russian Doll caching.
Add this line to your Gemfile:
gem 'cache_replace'
Add this line to a helper file, likely your ApplicationHelper:
include CacheReplace
This gem allows you to easily cache a partial of static html and replace inner dynamic html. Here is an example scenario:
You have some html that would be cached, except for some uncacheable code nested in the DOM. For example:
= render 'container'
.lots
.of
.htmls
= render 'dynamic'
= complicated_uncacheable_stuff
In the scenario above, you can't cache anything without resorting to madness. With cache_replace
, you can:
= render_cached 'container', replace: 'dynamic'
- cache "container" do
.lots
.of
.htmls
= cache_replace_key 'dynamic'
= complicated_uncacheable_stuff
In the above example, you could also remove the _dynamic.html.haml
file like so:
= render_cached 'container', replace: {dynamic: complicated_uncacheable_stuff}
render_cached
provides 4 calling styles:
render_cached "container", replace: "inner"
render_cached "container", replace: ["inner"]
render_cached "container", replace: {key_name: a_helper_method(object)}
render_cached "container" do
{key_name: a_helper_method(object)}
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 cache_replace 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.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.