Skip to content

Commit 23170e4

Browse files
committed
Add failing Behat scenarios for feedbackInfo session bleed-through (#1795)
feedbackInfo (the debug context shown on SAML error pages) was stored globally in the session. This caused two bugs: 1. Info from a failed auth flow could bleed into a subsequent unrelated error because storeFeedbackInfo() merged new data on top of old. 2. currentServiceProvider and currentIdentityProvider were never cleared after a successful login, so an early error after a completed auth would still show the SP/IdP from that auth. These two scenarios are added as failing tests to document the expected behaviour before the fix is in place.
1 parent 4e1fbba commit 23170e4

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

src/OpenConext/EngineBlockFunctionalTestingBundle/Features/ClearErrorMessages.feature

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,49 @@ Feature:
419419
Then I should see "Unknown key id"
420420
And I should see "Key ID: does-not-exist"
421421

422+
Scenario: feedbackInfo from a previous failed authentication should not bleed into a subsequent unrelated error
423+
# First auth: causes an error that writes IdP info into feedbackInfo in the session.
424+
Given the IdP is configured to always return Responses with StatusCode Responder/RequestDenied
425+
When I log in at "Dummy SP"
426+
And I pass through EngineBlock
427+
And I pass through the IdP
428+
Then I should see "Identity Provider error"
429+
And I should see "IdP:"
430+
# Second auth: causes an error that has no IdP context.
431+
# The stale IdP info from the previous error must NOT appear on this error page.
432+
When I log in at "Unconnected SP"
433+
Then I should see "No organisations found"
434+
And I should not see "IdP:"
435+
436+
Scenario: Global session context from a completed login should not appear in a subsequent unrelated error
437+
When I log in at "Dummy SP"
438+
And I pass through EngineBlock
439+
And I pass through the IdP
440+
And I give my consent
441+
And I pass through EngineBlock
442+
# Auth is now complete. An early error (before any SAML request is parsed) must not show
443+
# SP/IdP context that leaked from the completed auth into the session.
444+
When I post data "{}" to Engineblock URL "/authentication/idp/single-sign-on"
445+
Then I should see "The parameter \"SAMLRequest\" is missing on the SAML SSO request"
446+
And I should not see "IdP:"
447+
And I should not see "SP:"
448+
449+
Scenario: A previous failed auth's feedback context survives a subsequent successful login
450+
# Flow A: an error that has SP context but no IdP context.
451+
When I log in at "Unconnected SP"
452+
Then I should see "No organisations found"
453+
And I should see "SP:"
454+
# Flow B: a completely different, successful auth.
455+
When I log in at "Dummy SP"
456+
And I pass through EngineBlock
457+
And I pass through the IdP
458+
And I give my consent
459+
And I pass through EngineBlock
460+
# Navigate back to flow A's error page (as if via back button or bookmarked URL).
461+
# Flow A's SP context must still be readable from the session.
462+
When I go to Engineblock URL "/authentication/feedback/no-idps"
463+
Then I should see "SP:"
464+
422465
# Scenario: I try an unsolicited login (at EB) but mess up by not specifying a location
423466
# Scenario: I try an unsolicited login (at EB) but mess up by not specifying a binding
424467
# Scenario: I try an unsolicited login (at EB) but mess up by not specifying an invalid index

0 commit comments

Comments
 (0)