Class: RackSecurityMiddleware::BlockPathTraversal

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-security-middleware/block_path_traversal.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ BlockPathTraversal

Returns a new instance of BlockPathTraversal.



6
7
8
# File 'lib/rack-security-middleware/block_path_traversal.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rack-security-middleware/block_path_traversal.rb', line 10

def call(env)
  if has_path_traversal?(env['PATH_INFO'])
    [403, { 'Content-Type' => 'text/html' }, ['Forbidden']]
  else
    @app.call env
  end
end