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

Persist auth/state events at backwards extremities when we fetch them#6526

Merged
richvdh merged 7 commits into
developfrom
rav/event_auth/16
Dec 16, 2019
Merged

Persist auth/state events at backwards extremities when we fetch them#6526
richvdh merged 7 commits into
developfrom
rav/event_auth/16

Conversation

@richvdh
Copy link
Copy Markdown
Member

@richvdh richvdh commented Dec 11, 2019

The main point here is to make sure that the state returned by _get_state_in_room has been authed before we try to use it as state in the room.

The diff is a bit gnarly but I've tried to order it into distinct commits.

Based on #6524.

Comment thread changelog.d/6525.bugfix Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the other half of this bugfix is still incoming, btw.

@richvdh richvdh requested a review from a team December 11, 2019 17:51
@richvdh richvdh force-pushed the rav/event_auth/16 branch 2 times, most recently from fcbc5c5 to c618a0a Compare December 11, 2019 19:28
This means that we also do auth on them, which is useful for later operations
on them.
Any state or auth events returned by `_get_state_for_room` are now known to be
persisted, so there is no need to persist them again.
Comment thread synapse/handlers/federation.py Outdated

await self._handle_new_event(
destination, event, state=None, auth_events=auth,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be changing from persisting events in batches to doing them one by one, which feels like it'd be a bunch slower. Can we move the loop into here and then use the _handle_new_events?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've rearranged this in 44bd0fc. wdyt?

Copy link
Copy Markdown
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Err, that wasn't meant to be an approval, but I think it looks fine other than that

... by persisting any fetched events at the same time.
@richvdh richvdh requested a review from erikjohnston December 13, 2019 12:17
@richvdh richvdh merged commit bc7de87 into develop Dec 16, 2019
@richvdh richvdh deleted the rav/event_auth/16 branch December 16, 2019 12:26
richvdh added a commit that referenced this pull request Dec 16, 2019
…#6526)

The main point here is to make sure that the state returned by _get_state_in_room has been authed before we try to use it as state in the room.
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 pushed a commit that referenced this pull request Sep 1, 2021
…#6526)

* commit 'bc7de8765':
  Persist auth/state events at backwards extremities when we fetch them (#6526)
babolivier pushed a commit that referenced this pull request Sep 1, 2021
…#6526)

* commit 'ff773ff72':
  Persist auth/state events at backwards extremities when we fetch them (#6526)
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.

2 participants