mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
SECURITY: Don't reuse CSP nonce between anonymous requests
This commit is contained in:

committed by
David Taylor

parent
672f3e7e41
commit
0976c8fad6
@ -3,6 +3,8 @@
|
||||
RSpec.describe Middleware::AnonymousCache do
|
||||
let(:middleware) { Middleware::AnonymousCache.new(lambda { |_| [200, {}, []] }) }
|
||||
|
||||
before { Middleware::AnonymousCache.enable_anon_cache }
|
||||
|
||||
def env(opts = {})
|
||||
create_request_env(path: opts.delete(:path) || "http://test.com/path?bla=1").merge(opts)
|
||||
end
|
||||
|
@ -677,6 +677,8 @@ RSpec.describe Middleware::RequestTracker do
|
||||
after { Middleware::RequestTracker.unregister_detailed_request_logger(logger) }
|
||||
|
||||
it "can report data from anon cache" do
|
||||
Middleware::AnonymousCache.enable_anon_cache
|
||||
|
||||
cache = Middleware::AnonymousCache.new(app([200, {}, ["i am a thing"]]))
|
||||
tracker = Middleware::RequestTracker.new(cache)
|
||||
|
||||
|
Reference in New Issue
Block a user