Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Synapse will hide expired events from clients even if message retention policy support isn't enabled #8884

Closed
babolivier opened this issue Dec 4, 2020 · 1 comment · Fixed by #12611
Labels
A-Message-Retention-Policies Issues related to Synapse's support of MSC1763 (message retention policies) S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@babolivier
Copy link
Contributor

babolivier commented Dec 4, 2020

If retention.enabled is set to False in the configuration file, and a m.room.retention event is inserted into the state of a room, instead of only storing it (and ignoring it otherwise) Synapse will hide "expired" events from clients once their age gets higher than the retention policy's max_lifetime.

Practically, this means this happens with any Synapse, rather than only a Synapse with the feature enabled:

Peek 2020-12-04 22-36

(clear cache + reload was needed because Element doesn't implement this feature yet)

The impact of this bug isn't too high since we don't actually delete any event, however from a user perspective it strongly implies their messages get deleted when they don't which can be pretty confusing.

The issue lies within filter_events_for_client, which isn't aware of whether the feature is enabled whereas it should be. We would also need to change the 30 or so calls to this function throughout the Synapse codebase to give it that info (given we can't blindly assume it with a default value since it depends on the config, not on the context of the call).

@anoadragon453 anoadragon453 added z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution labels Dec 7, 2020
@babolivier babolivier added the A-Message-Retention-Policies Issues related to Synapse's support of MSC1763 (message retention policies) label Dec 3, 2021
@babolivier
Copy link
Contributor Author

Note that synapse-dinsic doesn't have this issue, because if the feature isn't enabled it returns a retention policy with None for both min_lifetime and max_lifetime: https://github.com/matrix-org/synapse-dinsic/blob/4737a7fd11060935279c0ed12c2eb27ab830d03d/synapse/storage/databases/main/room.py#L675-L679

This works but is a bit hacky, I'd be more in favour of giving filter_events_for_client the homeserver's config so it can check for itself (and would prevent similar issues from happening with other features).

@babolivier babolivier added S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. and removed z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution labels Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Message-Retention-Policies Issues related to Synapse's support of MSC1763 (message retention policies) S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants