Commit a8073782 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'bvl-request-forgery-protection-metrics' into 'master'

Don't modify env in request forgery protection

See merge request gitlab-org/gitlab!53609
parents 35132c45 33554c93
......@@ -23,7 +23,9 @@ module Gitlab
end
def self.verified?(env)
call(env)
minimal_env = env.slice('REQUEST_METHOD', 'rack.session', 'HTTP_X_CSRF_TOKEN')
.merge('rack.input' => '')
call(minimal_env)
true
rescue ActionController::InvalidAuthenticityToken
......
......@@ -52,6 +52,11 @@ RSpec.describe Gitlab::RequestForgeryProtection, :allow_forgery_protection do
end
describe '.verified?' do
it 'does not modify the env' do
env['REQUEST_METHOD'] = "GET"
expect { described_class.verified?(env) }.not_to change { env }
end
context 'when the request method is GET' do
before do
env['REQUEST_METHOD'] = 'GET'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment