SECURITY: enforce hostname to match discourse hostname

This ensures that the hostname rails uses for various helpers always matches
the Discourse hostname
This commit is contained in:
Sam
2018-11-15 15:22:02 +11:00
parent 6fde58ff90
commit e7001f879a
3 changed files with 36 additions and 0 deletions

View File

@ -213,6 +213,19 @@ RSpec.describe ApplicationController do
end
end
describe 'Custom hostname' do
it 'does not allow arbitrary host injection' do
get("/latest",
headers: {
"X-Forwarded-Host" => "test123.com"
}
)
expect(response.body).not_to include("test123")
end
end
describe 'Content Security Policy' do
it 'is enabled by SiteSettings' do
SiteSetting.content_security_policy = false