Commit Graph

6625 Commits

Author SHA1 Message Date
Quentin Gliech
02c8a7a92b Bump opa-wasm and wasmtime (#5455) 2026-01-27 21:06:08 +01:00
Devon Hudson
a10d0eedf9 Merge branch 'main' into devon/wasmtime-update 2026-01-27 18:46:11 +00:00
Devon Hudson
24729a7d78 Automatic merge back to main (#5454) 2026-01-27 18:46:03 +00:00
Devon Hudson
65c0a86da9 Bump opa-wasm and wasmtime 2026-01-27 11:36:49 -07:00
github-actions[bot]
d0da1052ac 1.10.0 2026-01-27 16:15:51 +00:00
Devon Hudson
e2d443a9a2 Translations updates for v1.10 (#5453) 2026-01-27 16:10:42 +00:00
github-actions[bot]
703ec74bb1 Translations updates 2026-01-27 15:53:13 +00:00
Quentin Gliech
93a72203a7 Clear out last active IP on each sessions after 30 days (#5448) 2026-01-26 13:57:01 +01:00
Quentin Gliech
270236cb4a Refactor inactive IP cleanup to use pagination
This should avoid dead many dead tuples when processing batches of
sessions to cleanup
2026-01-23 18:52:33 +01:00
Quentin Gliech
4806da8f2d Cleanup finished user/browser sessions (#5444) 2026-01-23 18:27:45 +01:00
Quentin Gliech
7688a8f8b7 Cleanup finished OAuth 2.0 sessions (#5443) 2026-01-23 18:23:55 +01:00
Quentin Gliech
845a448b71 Re-enable the upstream authentication sessions cleanup job (#5439) 2026-01-23 18:17:11 +01:00
Quentin Gliech
3320cf8cc2 Developer documentation about the various cleanup jobs (#5447) 2026-01-23 18:16:11 +01:00
Quentin Gliech
9afb0dd4ce Clean up leftovers in the database schema, part 2 (#5408) 2026-01-23 18:13:29 +01:00
Quentin Gliech
7abedeba83 Minor reword in the cleanup jobs documentation
Co-authored-by: Olivier 'reivilibre' <oliverw@element.io>
2026-01-23 17:43:13 +01:00
Quentin Gliech
82ba74d34f Clean up unsupported threepids from already deactivated users (#5407) 2026-01-23 17:42:46 +01:00
Quentin Gliech
f7db25bce2 Add cleanup jobs developer documentation 2026-01-23 16:37:52 +01:00
Quentin Gliech
256d11c5a1 Include pagination params in the tracing fields of cleanup methods 2026-01-23 16:30:26 +01:00
Quentin Gliech
b4025acc80 Add cleanup jobs for inactive session IP addresses
This adds three new scheduled cleanup jobs that clear the last_active_ip
field from sessions that have been inactive for more than 30 days:

- CleanupInactiveOAuth2SessionIpsJob
- CleanupInactiveCompatSessionIpsJob
- CleanupInactiveUserSessionIpsJob

This helps with data minimization by not retaining IP addresses longer
2026-01-23 16:29:29 +01:00
Quentin Gliech
85f71d2200 Add cleanup job for finished user sessions
Implements hard deletion of user/browser sessions that have been finished for more than 30 days, but only after all child sessions are cleaned up.

User sessions can only be deleted when no child sessions exist, ensuring backchannel logout propagation continues to work correctly.
2026-01-22 15:44:57 +01:00
Quentin Gliech
c508c7899e Fix FK constraint to preserve backchannel logout chain
Change compat_sessions.user_session_id FK from ON DELETE SET NULL to ON DELETE NO ACTION. This prevents deletion of user_sessions while compat_sessions still reference them, which is critical for backchannel logout propagation.

When an upstream IdP sends a backchannel logout, MAS must trace through:
  upstream_oauth_authorization_sessions -> user_sessions -> compat_sessions

If user_session_id links are SET NULL, logout propagation fails.

Uses two-step migration (DROP+ADD NOT VALID, then VALIDATE) to minimize table locking during deployment.
2026-01-22 15:44:57 +01:00
Quentin Gliech
3b0937ca8e Add cleanup job for finished OAuth2 sessions
Implements hard deletion of OAuth2 sessions that have been finished for more than 30 days, including their associated access and refresh tokens.
2026-01-22 15:44:56 +01:00
matrixbot
755268ba79 Automatic merge back to main (#5441) 2026-01-21 16:04:19 +01:00
github-actions[bot]
e125ee3009 1.10.0-rc.0 2026-01-21 14:56:30 +00:00
Quentin Gliech
dd1fdb06c4 Translations updates for main (#5440) 2026-01-21 15:55:30 +01:00
github-actions[bot]
5de8766f63 Translations updates 2026-01-21 14:45:17 +00:00
Quentin Gliech
49802c7812 Re-enable upstream OAuth session cleanup job
It should be safe to run now
2026-01-21 14:50:03 +01:00
Quentin Gliech
f8e87ec2c4 Use the user_session_id on upstream authorisations for filtering instead
of authentications

This makes it one less table to read
2026-01-21 14:49:07 +01:00
Quentin Gliech
b912fbc0c9 Add trigger and backfill for upstream OAuth user session tracking
Introduce a new trigger and a backfill migration to populate the
`user_session_id` column in `upstream_oauth_authorization_sessions`
based on `user_session_authentications`. This ensures historical data is
consistent and aids in backward compatibility.
2026-01-21 14:49:07 +01:00
Quentin Gliech
76b971ad45 Add index on the user_session_id foreign key for upstream auth sessions 2026-01-21 14:49:07 +01:00
Quentin Gliech
1fd3c6ff55 Do not cleanup upstream OAuth sessions that may still be useful (#5437) 2026-01-21 13:20:38 +01:00
Quentin Gliech
2425ebda71 Disable cleanup of upstream OAuth sessions
This job is temporarily disabled due to pending database backfill work.
It will be re-enabled in a future release.
2026-01-21 12:28:19 +01:00
Quentin Gliech
39e417b461 Only cleanup orphan upstream authorization sessions
This includes sessions that were never completed, and sessions where
user_session was cleaned up. This is to avoid breaking features like
OIDC Backchannel Logout after 30 days.
2026-01-21 12:25:42 +01:00
Quentin Gliech
63f02c4dea Track user session authenticated through upstream auth sessions
This will help us avoid clearing upstream authorization sessions that
might still be useful to keep around for OIDC Backchannel Logouts
2026-01-21 12:19:05 +01:00
Quentin Gliech
eb76e8d3ae Consume upstream authorization sessions later in the user registration
flow

The main goal of this is to allow tracking user sessions authed by an
upstream authorization session, but this also has the nice side effect
of allowing 'going back' in browser history within the registration flow
2026-01-21 12:15:09 +01:00
Quentin Gliech
50ecdf7e63 build(deps): bump @vector-im/compound-web from 8.3.1 to 8.3.5 in /frontend (#5431) 2026-01-20 16:41:46 +01:00
Quentin Gliech
d5226b9bc9 Update test snapshots 2026-01-20 16:34:22 +01:00
Quentin Gliech
b9441ba975 Add support for the unstable prefix of MSC3824 (#5434) 2026-01-20 16:32:43 +01:00
Quentin Gliech
7b97321531 Fix foreign key constraint when cleaning up upstream OAuth 2.0 links (#5432) 2026-01-20 16:30:41 +01:00
Quentin Gliech
7de091769c Handle deleted and invalid post-auth actions (#5433) 2026-01-20 16:23:54 +01:00
olivierdelcroix
244ab94e5e add unstable prefix for MSC3824 2026-01-20 15:34:47 +01:00
Quentin Gliech
be00483fb4 Handle deleted and invalid post-auth actions 2026-01-20 14:42:02 +01:00
Quentin Gliech
e7c1f126be Fix foreign key constraint when cleaning up upstream OAuth 2.0 links
https://sentry.tools.element.io/organizations/element/issues/11222736/
2026-01-20 14:29:27 +01:00
Quentin Gliech
ab90e89685 Cleanup old completed jobs from the database (#5427) 2026-01-19 16:57:09 +01:00
dependabot[bot]
3dfffc50eb build(deps): bump @vector-im/compound-web in /frontend
Bumps [@vector-im/compound-web](https://github.com/element-hq/compound-web) from 8.3.1 to 8.3.5.
- [Release notes](https://github.com/element-hq/compound-web/releases)
- [Commits](https://github.com/element-hq/compound-web/compare/v8.3.1...v8.3.5)

---
updated-dependencies:
- dependency-name: "@vector-im/compound-web"
  dependency-version: 8.3.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-19 15:52:41 +00:00
Quentin Gliech
1254d9f8f0 Mark the next attempt foreign key as initially not valid 2026-01-19 15:44:22 +01:00
Quentin Gliech
9268d5199e Cleanup old upstream OAuth sessions and unlinked links (#5426) 2026-01-19 15:14:12 +01:00
Quentin Gliech
50e734a866 Cleanup old email authentications & account recoveries (#5425) 2026-01-19 15:12:02 +01:00
Quentin Gliech
3b61660d18 Cleanup old OAuth grants (#5424) 2026-01-19 15:11:48 +01:00
Quentin Gliech
1253bbd498 Implement cleanup job for queue jobs
Add scheduled cleanup job that removes old completed and failed queue
jobs after 30 days. Jobs are kept for debugging purposes.

Includes migration to change the next_attempt_id FK constraint from NO
ACTION to SET NULL, allowing cleanup of retry chains without breaking
foreign key constraints.

One caveat is that cleanup is based on their creation time, *not* when
they got completed/failed. This means that if the job takes a long time
(as in, several days) to get scheduled, it might get cleared as soon as
it runs. This is fine for now, we may want to revisit this if we start
scheduling jobs far in the future
2026-01-19 12:25:04 +01:00