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

Use the filtered version of an event when responding to /context requests for that event #6553

Merged
merged 8 commits into from
Dec 16, 2019

Conversation

babolivier
Copy link
Contributor

@babolivier babolivier commented Dec 16, 2019

Sometimes the filtering function can return a pruned version of an event (instead of either the event itself or an empty list), if it thinks the user should be able to see that there's an event there but not the content of that event. Therefore, the previous logic of 'if filtered is empty then we can use the event we retrieved from the database' is flawed, and we should use the event returned by the filtering function.

…ests for that event

Sometimes the filtering function can return a pruned version of an event (on top of either the event itself or an empty list), if it thinks the user should be able to see that there's an event there but not the content of that event. Therefore, the previous logic of 'if filtered is empty then we can use the event we retrieved from the database' is flawed, and we should use the event returned by the filtering function.
@babolivier babolivier requested a review from a team December 16, 2019 12:20
@babolivier babolivier requested a review from a team December 16, 2019 15:38
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, though shoudn't we filter state events too?

tests/rest/client/v1/test_rooms.py Outdated Show resolved Hide resolved
@babolivier babolivier merged commit 6316530 into release-v1.7.1 Dec 16, 2019
richvdh added a commit that referenced this pull request Dec 18, 2019
Synapse 1.7.1 (2019-12-18)
==========================

This release includes several security fixes as well as a fix to a bug exposed by the security fixes. Administrators are encouraged to upgrade as soon as possible.

Security updates
----------------

- Fix a bug which could cause room events to be incorrectly authorized using events from a different room. ([\#6501](#6501), [\#6503](#6503), [\#6521](#6521), [\#6524](#6524), [\#6530](#6530), [\#6531](#6531))
- Fix a bug causing responses to the `/context` client endpoint to not use the pruned version of the event. ([\#6553](#6553))
- Fix a cause of state resets in room versions 2 onwards. ([\#6556](#6556), [\#6560](#6560))

Bugfixes
--------

- Fix a bug which could cause the federation server to incorrectly return errors when handling certain obscure event graphs. ([\#6526](#6526), [\#6527](#6527))
@babolivier babolivier deleted the babolivier/fix-context-filter branch January 9, 2020 15:45
babolivier pushed a commit that referenced this pull request Sep 1, 2021
* commit '631653036':
  Incorporate review
  Update changelog.d/6553.bugfix
  Lint
  Add test case
  Changelog
  Update the documentation of the filtering function
  Use the filtered version of an event when responding to /context requests for that event
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants