sinatra/rack-protection
ninoseki 875f36f963 Change relative URLs to absolute URLS 2017-05-24 09:48:41 +09:00
..
lib 2.0.0 release 2017-05-07 09:02:22 +09:00
spec Merge pull request #1265 from jkowens/fix-1260 2017-03-13 13:09:36 +09:00
.gitignore [issue-1275] add rake task to generate docs, similar to sinatra-contrib 2017-04-09 12:30:24 +05:30
.rspec Restore RSpec init default files 2014-09-03 19:25:20 +02:00
.travis.yml I guess rvm started failing the build once sudo was enabled 2016-07-25 17:35:59 +09:00
Gemfile Test vendor'd gems using local paths instead of git 2016-08-17 19:33:45 +09:00
License Update LICENSE(s) 2017-03-19 12:05:31 +09:00
README.md Change relative URLs to absolute URLS 2017-05-24 09:48:41 +09:00
Rakefile Write readme to includes as well 2017-05-08 08:59:12 +09:00
rack-protection.gemspec Update homepages for sinatra-contrib and rack-protection 2017-05-15 17:28:47 -07:00

README.md

Rack::Protection

This gem protects against typical web attacks. Should work for all Rack apps, including Rails.

Usage

Use all protections you probably want to use:

# config.ru
require 'rack/protection'
use Rack::Protection
run MyApp

Skip a single protection middleware:

# config.ru
require 'rack/protection'
use Rack::Protection, :except => :path_traversal
run MyApp

Use a single protection middleware:

# config.ru
require 'rack/protection'
use Rack::Protection::AuthenticityToken
run MyApp

Prevented Attacks

Cross Site Request Forgery

Prevented by:

Cross Site Scripting

Prevented by:

Clickjacking

Prevented by:

Directory Traversal

Prevented by:

Session Hijacking

Prevented by:

Prevented by:

IP Spoofing

Prevented by:

Prevented by:

Installation

gem install rack-protection

Instrumentation

Instrumentation is enabled by passing in an instrumenter as an option.

use Rack::Protection, instrumenter: ActiveSupport::Notifications

The instrumenter is passed a namespace (String) and environment (Hash). The namespace is 'rack.protection' and the attack type can be obtained from the environment key 'rack.protection.attack'.