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

Fix potential leak of per-room profiles when the user dir is rebuilt. #10981

Merged
merged 9 commits into from
Oct 5, 2021

Commits on Oct 4, 2021

  1. Conceal local user nicknames when rebuilding dir

    There are two steps to rebuilding the user directory:
    
    1. a scan over rooms, followed by
    2. a scan over local users.
    
    The former reads avatars and displaynames from the `room_memberships`
    table and therefore contains potentially private avatars and
    displaynames. The latter reads from the the `profiles` table which only
    contains public data; moreover it will overwrite any private profiles
    that the rooms scan may have written to the user directory. This means
    that the rebuild could leak private user while the rebuild was in
    progress, but would eventually cover up the leaks once the rebuild
    completed.
    
    This change skips over local users when writing user_directory rows
    when scanning rooms. Doing so means that it'll take longer for a rebuild
    to make local users searchable, which is unfortunate. I think a future
    PR can improve this by swapping the order of the two steps above. (And
    indeed there's more to do here, e.g. copying from `profiles` without
    going via Python.)
    David Robertson committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    5ee9fef View commit details
    Browse the repository at this point in the history
  2. Remove duplicated code from test_initial

    This was meant to be pulled into `purge_and_rebuild_user_dir`
    David Robertson committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    4e69df4 View commit details
    Browse the repository at this point in the history
  3. Move is_public before updating sharing tables

    No functional change; it's still before the first read of `is_public`.
    David Robertson committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    b9254eb View commit details
    Browse the repository at this point in the history
  4. Don't bother creating a set from dict keys

    Slightly nicer and makes the code simpler.
    David Robertson committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    b10d6a4 View commit details
    Browse the repository at this point in the history
  5. Changelog

    David Robertson committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    e6880b7 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2021

  1. Don't hit the private branch if room is public and users_with_profile…

    … is empty
    
    Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
    David Robertson and richvdh authored Oct 5, 2021
    Configuration menu
    Copy the full SHA
    f20d78c View commit details
    Browse the repository at this point in the history
  2. Fix indentation

    Rich did ask me to, I just didn't listen
    David Robertson committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    118eecf View commit details
    Browse the repository at this point in the history
  3. Docstrings

    David Robertson committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    abd943a View commit details
    Browse the repository at this point in the history
  4. Improved comments(?)

    David Robertson committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    7ea8188 View commit details
    Browse the repository at this point in the history