You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/vendor/bundle/ruby/4.0.0/gems/rack-protection-4.2.1
Wabo d9b86d464c
Restore fork-specific features lost during upstream sync:
3 weeks ago
..
lib Restore fork-specific features lost during upstream sync: 3 weeks ago
Gemfile Restore fork-specific features lost during upstream sync: 3 weeks ago
License Restore fork-specific features lost during upstream sync: 3 weeks ago
README.md Restore fork-specific features lost during upstream sync: 3 weeks ago
Rakefile Restore fork-specific features lost during upstream sync: 3 weeks ago
rack-protection.gemspec Restore fork-specific features lost during upstream sync: 3 weeks ago

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

DNS rebinding and other Host header 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'.