Problem/Motivation

The module overrides the /user/logout route. Due to this override, the CSRF protection introduced in Drupal 10.3 was lost.

Proposed resolution

✅ Add _csrf_token: 'TRUE' to the openid_connect.logout route.
✅ Add followup issue to introduce the logout confirmation form (https://www.drupal.org/project/openid_connect/issues/3518252).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aalin created an issue. See original summary.

pfrilling’s picture

Assigned: Unassigned » pfrilling

Thanks for the report. Working on this today.

pfrilling’s picture

Assigned: pfrilling » Unassigned
Issue summary: View changes
Status: Active » Needs review

CSRF protection and tests confirming have been added to the logout route.

I think we create a follow up issue to introduce the _csrf_confirm_form_route that mimics the OpenIDConnectRedirectController::redirectLogout. That seemed like a bigger refactor and likely warrants a separate issue.

jibus’s picture

I applied the patch.

The user/logout route now returns a 403.

This is the logical behavior, but is it the expected behavior?

Shouldn't we have the confirmation form?

pfrilling’s picture

@jibus, Yes, I do think we need to add the confirmation form to match core's workflow, but I was planning on doing that work in a separate issue.

jibus’s picture

@pfrilling You specified it, my bad.

pfrilling’s picture

Status: Needs review » Reviewed & tested by the community

I'm marking this as RTBC from @jibus's review in #5.

  • pfrilling committed be314198 on 3.x
    Issue #3508791 by pfrilling, jibus, aalin: Add CSRF protection for /user...
pfrilling’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Code has been merged and the followup issue has been created to add the confirmation form here: https://www.drupal.org/project/openid_connect/issues/3518252

attheshow’s picture

I just wanted to post a heads up here. It looks like this change is for some reason causing a 403 error when a currently-logged-in user visits /user/logout on D11.

pfrilling’s picture

Thanks @attheshow. That is expected as the route requires a csrf token. Browsing directly to that route won't have the token, hence the 403. If you use the logout link provided by a menu and/or the login block, it should work. The followup issue #3518252: Add _csrf_confirm_form_route option for to the user/logout route will get that direct link remedied with a confirmation form.

attheshow’s picture

OK, I'll go ahead and put together a patch for our site so that we can continue to use our existing logout links on D11.

pfrilling’s picture

The confirmation form logic is in place here: https://www.drupal.org/project/openid_connect/issues/3518252.

@attheshow, are you able to manually test that MR and confirm if it works for your use case?

attheshow’s picture

Sorry, I haven't been able to test that just yet.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.