Skip to content

Cannot login in OIDC on localhost + Webkit #19303

@moufmouf

Description

@moufmouf

Description

Hey Synapse team!

In October, the following change was done to Synapse:

Update oidc_session_no_samesite cookie to be Secure
#19079

I'm running a test environment locally (and Playwright E2E tests in CI). Since this change, I cannot connect to Synapse via OIDC anymore. I'm getting this error:

Image

The origin of the issue is that unlike the other browsers, Webkit treats "localhost" as non-secure regarding cookies. So when you add "Secure", Webkit stops storing cookies locally.

See tauri-apps/tauri#2604

Steps to reproduce

  • set up a local environment with Synapse connected a OIDC provider (everything running on localhost)
  • try to connect

Homeserver

Dev homeserver at Synapse 1.144.0

Synapse Version

1.144.0

Installation Method

Docker (matrixdotorg/synapse)

Database

SQLite

Workers

Single process

Platform

Configuration

This happens in a development environment where there is no HTTPS.
Synapse domain name is "http://matrix.localhost", running in a docker-compose behind a reverse-proxy.

Relevant log output

-

Anything else that would be useful to know?

I think the fact of being able to login in Synapse via OIDC is important in a development environment where no HTTPS is available. Do you think it is possible to remove the "Secure" part of the cookie if we detect a request comes from HTTP? (and keep it in HTTPS?)

A more restrictive version could check if the request comes from "localhost" or "*.localhost". Not sure if this is needed though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions