mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Merge pull request #13 from hecticjeff/json-csrf-warning
Show warnings for JsonCsrf attacks
This commit is contained in:
commit
2eb0092cd2
1 changed files with 4 additions and 1 deletions
|
@ -16,7 +16,10 @@ module Rack
|
|||
def call(env)
|
||||
status, headers, body = app.call(env)
|
||||
if headers['Content-Type'].to_s.split(';', 2).first =~ /^\s*application\/json\s*$/
|
||||
result = react(env) if referrer(env) != Request.new(env).host
|
||||
if referrer(env) != Request.new(env).host
|
||||
result = react(env)
|
||||
warn env, "attack prevented by #{self.class}"
|
||||
end
|
||||
end
|
||||
result or [status, headers, body]
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue