Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
It's raining XSS out there. Time for a slicker!
Simple XSS protection was a feature of some early Rails plugins, notably WhiteList and sanitize_params, which defended your application at the front door - the params hash, where you probably get most of your input.
This is a port of the basic sanitize_params strategy into gem format, and with no dependency on Rails - it will also work in Sinatra, Padrino, or a straight Ruby application.
Using it is pretty simple. In its most basic form:
# Rails
before_filter :protect_from_xss
# Padrino
before do
protect_from_xss
end
# Either framework
def protect_from_xss
Slicker.protect(params)
end
Drop that in your ApplicationController (for Rails) or your app.rb file (Sinatra or Padrino), and you're done: all HTML will be stripped from all params hitting your application. Of course, the disadvantage of this is that all HTML will be stripped from all params hitting your application.
You can loosen this up in several different ways.
Slicker depends on sanitize, so you can also pass a Sanitize config through, and strip only certain tags:
Slicker.protect(params, Sanitize::Config::BASIC)
See the Sanitize[https://github.com/rgrove/sanitize] documentation for more information on what you can pass.
Another way to loosen things up is to be a bit more selective in your filters, perhaps by using skip_before_filter
or by not putting the filter in the superclass of the entire application.
Copyright (c) 2012-2018 Dave Hrycyszyn. See LICENSE.txt for further details.
FAQs
Unknown package
We found that slicker 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.