Skip to content
Snippets Groups Projects
Unverified Commit 21a23caa authored by David Taylor's avatar David Taylor Committed by GitHub
Browse files

FIX: Add `content-type` header to auto-submitting form (#56)

In the vast majority of cases, this wasn't causing a problem because browsers will auto-detect the content-type. However, if any intermediate proxies add the `X-Content-Type-Options: nosniff` header, then the html will be displayed as plain text, and login will be broken.
parent 792a51c9
No related branches found
No related tags found
No related merge requests found
...@@ -73,8 +73,7 @@ class ::DiscourseSaml::SamlOmniauthStrategy < OmniAuth::Strategies::SAML ...@@ -73,8 +73,7 @@ class ::DiscourseSaml::SamlOmniauthStrategy < OmniAuth::Strategies::SAML
</html> </html>
HTML HTML
r = Rack::Response.new r = Rack::Response.new(html, 200, { 'content-type' => 'text/html' })
r.write(html)
r.finish r.finish
end end
end end
...@@ -20,6 +20,7 @@ describe "SAML POST-mode functionality", type: :request do ...@@ -20,6 +20,7 @@ describe "SAML POST-mode functionality", type: :request do
SiteSetting.saml_request_method = "POST" SiteSetting.saml_request_method = "POST"
post "/auth/saml" post "/auth/saml"
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.headers["content-type"]).to eq("text/html")
expect(response.body).to have_tag( expect(response.body).to have_tag(
"form", "form",
with: { with: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment