Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
hryk-sinatra-content-for
Advanced tools
= ContentFor
Small extension for the Sinatra[http://sinatrarb.com] web framework that allows you to use the following helpers in your views:
<% content_for :some_key do %>
<chunk of="html">...</chunk>
<% end %>
<% yield_content :some_key %>
This allows you to capture blocks inside views to be rendered later in this request. For example, to populate different parts of your layout from your view.
When using this with the Haml rendering engine, you should do the following:
- content_for :some_key do
%chunk{ :of => "html" } ...
= yield_content :some_key
Note that with ERB yield_content is called without an '=' block (<%= %>), but with Haml it uses = yield_content.
Using an '=' block in ERB will output the content twice for each block, so if you have problems with that, make sure to check for this.
== Usage
If you're writing "classic" style apps, then requring sinatra/content_for should be enough. If you're writing "classy" apps, then you also need to call helpers Sinatra::ContentFor in your app definition.
== And how is this useful?
For example, some of your views might need a few javascript tags and stylesheets, but you don't want to force this files in all your pages. Then you can put <% yield_content :scripts_and_styles %> on your layout, inside the tag, and each view can call content_for setting the appropriate set of tags that should be added to the layout.
== Credits
Code by foca[http://github.com/foca], inspired on the Ruby on Rails helpers with the same name. Haml support by mattly[http://github.com/mattly].
FAQs
Unknown package
We found that hryk-sinatra-content-for 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.