mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
SECURITY: Ensure user-agent-based responses are cached separately (#16475)
This commit is contained in:
@ -78,6 +78,20 @@ describe Middleware::AnonymousCache do
|
||||
end
|
||||
end
|
||||
|
||||
it "handles old browsers" do
|
||||
SiteSetting.browser_update_user_agents = "my_old_browser"
|
||||
|
||||
key1 = new_helper("HTTP_USER_AGENT" => "my_old_browser").cache_key
|
||||
key2 = new_helper("HTTP_USER_AGENT" => "my_new_browser").cache_key
|
||||
expect(key1).not_to eq(key2)
|
||||
end
|
||||
|
||||
it "handles modern mobile browsers" do
|
||||
key1 = new_helper("HTTP_USER_AGENT" => "Safari (iPhone OS 7)").cache_key
|
||||
key2 = new_helper("HTTP_USER_AGENT" => "Safari (iPhone OS 15)").cache_key
|
||||
expect(key1).not_to eq(key2)
|
||||
end
|
||||
|
||||
context "cached" do
|
||||
let!(:helper) do
|
||||
new_helper("ANON_CACHE_DURATION" => 10)
|
||||
|
Reference in New Issue
Block a user