Skip to content
Snippets Groups Projects
  1. Oct 04, 2021
    • David Robertson's avatar
      Consistently exclude from user_directory (#10960) · f7b034a2
      David Robertson authored
      * Introduce `should_include_local_users_in_dir`
      
      We exclude three kinds of local users from the user_directory tables. At
      present we don't consistently exclude all three in the same places. This
      commit introduces a new function to gather those exclusion conditions
      together. Because we have to handle local and remote users in different
      ways, I've made that function only consider the case of remote users.
      It's the caller's responsibility to make the local versus remote
      distinction clear and correct.
      
      A test fixup is required. The test now hits a path which makes db
      queries against the users table. The expected rows were missing, because
      we were using a dummy user that hadn't actually been registered.
      
      We also add new test cases to covert the exclusion logic.
      
      ----
      
      By my reading this makes these changes:
      
      * When an app service user registers or changes their profile, they will
        _not_ be added to the user directory. (Previously only support and
        deactivated users were excluded). This is consistent with the logic that
        rebuilds the user directory. See also [the discussion
        here](https://github.com/matrix-org/synapse/pull/10914#discussion_r716859548
      
      ).
      * When rebuilding the directory, exclude support and disabled users from
        room sharing tables. Previously only appservice users were excluded.
      * Exclude all three categories of local users when rebuilding the
        directory. Previously `_populate_user_directory_process_users` didn't do
        any exclusion.
      
      Co-authored-by: default avatarRichard van der Hoff <1389908+richvdh@users.noreply.github.com>
      Unverified
      f7b034a2
    • Patrick Cloke's avatar
  2. Oct 01, 2021
  3. Sep 30, 2021
  4. Sep 29, 2021
  5. Sep 28, 2021
    • Richard van der Hoff's avatar
      Inline `_check_event_auth` for outliers (#10926) · 2622b28c
      Richard van der Hoff authored
      * Inline `_check_event_auth` for outliers
      
      When we are persisting an outlier, most of `_check_event_auth` is redundant:
      
       * `_update_auth_events_and_context_for_auth` does nothing, because the
         `input_auth_events` are (now) exactly the event's auth_events,
         which means that `missing_auth` is empty.
      
       * we don't care about soft-fail, kicking guest users or `send_on_behalf_of`
         for outliers
      
      ... so the only thing that matters is the auth itself, so let's just do that.
      
      * `_auth_and_persist_fetched_events_inner`: de-async `prep`
      
      `prep` no longer calls any `async` methods, so let's make it synchronous.
      
      * Simplify `_check_event_auth`
      
      We no longer need to support outliers here, which makes things rather simpler.
      
      * changelog
      
      * lint
      Unverified
      2622b28c
  6. Sep 27, 2021
  7. Sep 24, 2021
    • Brendan Abolivier's avatar
      Add a spamchecker callback to allow or deny room creation based on invites (#10898) · b10257e8
      Brendan Abolivier authored
      This is in the context of creating new module callbacks that modules in https://github.com/matrix-org/synapse-dinsic can use, in an effort to reconcile the spam checker API in synapse-dinsic with the one in mainline.
      
      This adds a callback that's fairly similar to user_may_create_room except it also allows processing based on the invites sent at room creation.
      Unverified
      b10257e8
    • Patrick Cloke's avatar
    • Richard van der Hoff's avatar
      Factor out common code for persisting fetched auth events (#10896) · 85551b7a
      Richard van der Hoff authored
      * Factor more stuff out of `_get_events_and_persist`
      
      It turns out that the event-sorting algorithm in `_get_events_and_persist` is
      also useful in other circumstances. Here we move the current
      `_auth_and_persist_fetched_events` to `_auth_and_persist_fetched_events_inner`,
      and then factor the sorting part out to `_auth_and_persist_fetched_events`.
      
      * `_get_remote_auth_chain_for_event`: remove redundant `outlier` assignment
      
      `get_event_auth` returns events with the outlier flag already set, so this is
      redundant (though we need to update a test where `get_event_auth` is mocked).
      
      * `_get_remote_auth_chain_for_event`: move existing-event tests earlier
      
      Move a couple of tests outside the loop. This is a bit inefficient for now, but
      a future commit will make it better. It should be functionally identical.
      
      * `_get_remote_auth_chain_for_event`: use `_auth_and_persist_fetched_events`
      
      We can use the same codepath for persisting the events fetched as part of an
      auth chain as for those fetched individually by `_get_events_and_persist` for
      building the state at a backwards extremity.
      
      * `_get_remote_auth_chain_for_event`: use a dict for efficiency
      
      `_auth_and_persist_fetched_events` sorts the events itself, so we no longer
      need to care about maintaining the ordering from `get_event_auth` (and no
      longer need to sort by depth in `get_event_auth`).
      
      That means that we can use a map, making it easier to filter out events we
      already have, etc.
      
      * changelog
      
      * `_auth_and_persist_fetched_events`: improve docstring
      Unverified
      85551b7a
    • Erik Johnston's avatar
    • Jason Robinson's avatar
      Fix AuthBlocking check when requester is appservice (#10881) · fa745363
      Jason Robinson authored
      
      If the MAU count had been reached, Synapse incorrectly blocked appservice users even though they've been explicitly configured not to be tracked (the default). This was due to bypassing the relevant if as it was chained behind another earlier hit if as an elif.
      
      Signed-off-by: default avatarJason Robinson <jasonr@matrix.org>
      Unverified
      fa745363
    • David Robertson's avatar
      Improve typing in user_directory files (#10891) · 7f335274
      David Robertson authored
      
      * Improve typing in user_directory files
      
      This makes the user_directory.py in storage pass most of mypy's
      checks (including `no-untyped-defs`). Unfortunately that file is in the
      tangled web of Store class inheritance so doesn't pass mypy at the moment.
      
      The handlers directory has already been mypyed.
      
      Co-authored-by: default avatarreivilibre <olivier@librepush.net>
      Unverified
      7f335274
  8. Sep 23, 2021
  9. Sep 22, 2021
  10. Sep 21, 2021
  11. Sep 16, 2021
  12. Sep 14, 2021
  13. Sep 13, 2021
  14. Sep 10, 2021
Loading