element-hq / element-hq/synapse
We might not be correctly clearing OIDC cookies when handling an OIDC callback
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#12782](https://github.com/matrix-org/synapse/issues/12782).
---
> Looking at sentry, this one is really weird. It happens when `session == b""`, which might be a result of the cookie clearing done before. Testing it a bit, on Safari, it looks like the cookie clearing line 201 does not clear the cookie properly, and instead sets it to a blank value, hence the issue.
> So, it's a legit exception, and probably a legit bug because we're not clearing the cookie properly.
_Originally posted by @sandhose in https://github.com/matrix-org/synapse/pull/12723#discussion_r874834174_
The lines in question:
https://github.com/matrix-org/synapse/blob/df3c432ed6e5b47f06970251024fd93038a1e6cd/synapse/handlers/oidc.py#L193-L205
And the sentry report: https://sentry.matrix.org/sentry/synapse-matrixorg/issues/219508/?query=is%3Aunresolved
Contributor guide
Research direction
Start in synapse/handlers/oidc.py at the cookie-clearing code around lines 193-205, then review the linked Sentry report and the callback path for the session == b"" case. Reproduce or investigate the Safari behavior described in the issue. Done means the OIDC callback clears the cookie correctly instead of leaving a blank value and avoids the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100