Skip to content

Commit 5d06805

Browse files
rubocop
1 parent 70cf822 commit 5d06805

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

spec/omniauth/strategies/saml_spec.rb

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -291,47 +291,47 @@ def post_xml(xml = :example_response, opts = {})
291291

292292
end
293293

294-
context "when response relay state is invalid" do
295-
let(:saml_options) { super().merge(slo_default_relay_state: '/signed-out') }
296-
let(:params) do
297-
{
298-
SAMLResponse: load_xml(:example_logout_response),
299-
RelayState: "https://example.com/",
300-
}
301-
end
294+
context "when response relay state is invalid" do
295+
let(:saml_options) { super().merge(slo_default_relay_state: '/signed-out') }
296+
let(:params) do
297+
{
298+
SAMLResponse: load_xml(:example_logout_response),
299+
RelayState: "https://example.com/",
300+
}
301+
end
302302

303-
let(:opts) do
304-
{"rack.session" => {"saml_transaction_id" => "_3fef1069-d0c6-418a-b68d-6f008a4787e9"}}
305-
end
303+
let(:opts) do
304+
{ "rack.session" => { "saml_transaction_id" => "_3fef1069-d0c6-418a-b68d-6f008a4787e9" } }
305+
end
306306

307-
subject { post "/auth/saml/slo", params, opts }
307+
subject { post "/auth/saml/slo", params, opts }
308308

309-
[
310-
"//attacker.test",
311-
"javascript:alert(1)",
312-
].each do |unsafe_relay_state|
313-
context "#{unsafe_relay_state}" do
314-
let(:params) { super().merge(RelayState: unsafe_relay_state)}
309+
[
310+
"//attacker.test",
311+
"javascript:alert(1)",
312+
].each do |unsafe_relay_state|
313+
context "#{unsafe_relay_state}" do
314+
let(:params) { super().merge(RelayState: unsafe_relay_state)}
315315

316-
it 'falls back to the default' do
317-
is_expected.to be_redirect.and have_attributes(location: "/signed-out")
318-
end
316+
it 'falls back to the default' do
317+
is_expected.to be_redirect.and have_attributes(location: "/signed-out")
319318
end
320319
end
320+
end
321321

322-
context 'when absolute https relay state' do
323-
let(:params) { super().merge(RelayState: "https://example.com/logout")}
322+
context 'when absolute https relay state' do
323+
let(:params) { super().merge(RelayState: "https://example.com/logout")}
324324

325-
it { is_expected.to be_redirect.and have_attributes(location: "https://example.com/logout") }
326-
end
325+
it { is_expected.to be_redirect.and have_attributes(location: "https://example.com/logout") }
326+
end
327327

328-
context 'when there is no safe fallback' do
329-
let(:saml_options) { super().except(:slo_default_relay_state) }
330-
let(:params) { super().merge(RelayState: 'javascript:alert(1)')}
328+
context 'when there is no safe fallback' do
329+
let(:saml_options) { super().except(:slo_default_relay_state) }
330+
let(:params) { super().merge(RelayState: 'javascript:alert(1)')}
331331

332-
it { expect { subject }.to raise_error(OmniAuth::Strategies::SAML::ValidationError, "Invalid RelayState") }
333-
end
332+
it { expect { subject }.to raise_error(OmniAuth::Strategies::SAML::ValidationError, "Invalid RelayState") }
334333
end
334+
end
335335

336336

337337
context "when request is a logout request" do

0 commit comments

Comments
 (0)