Skip to content
Snippets Groups Projects
  1. Mar 05, 2025
  2. Feb 25, 2025
    • Quentin Gliech's avatar
      Fix MSC4108 'rendez-vous' responses with some reverse proxy in the front of Synapse (#18178) · b9276e21
      Quentin Gliech authored
      MSC4108 relies on ETag to determine if something has changed on the
      rendez-vous channel.
      Strong and correct ETag comparison works if the response body is
      bit-for-bit identical, which isn't the case if a proxy in the middle
      compresses the response on the fly.
      
      This adds a `no-transform` directive to the `Cache-Control` header,
      which tells proxies not to transform the response body.
      
      Additionally, some proxies (nginx) will switch to `Transfer-Encoding:
      chunked` if it doesn't know the Content-Length of the response, and
      'weakening' the ETag if that's the case. I've added `Content-Length`
      headers to all responses, to hopefully solve that.
      
      This basically fixes QR-code login when nginx or cloudflare is involved,
      with gzip/zstd/deflate compression enabled.
      b9276e21
  3. Feb 10, 2025
  4. Dec 05, 2024
  5. Nov 27, 2024
  6. Nov 26, 2024
  7. Nov 14, 2024
  8. Oct 14, 2024
  9. Jun 13, 2024
  10. May 08, 2024
  11. Apr 29, 2024
  12. Apr 25, 2024
  13. Apr 18, 2024
    • Quentin Gliech's avatar
      Helpers to transform Twisted requests to Rust http Requests/Responses (#17081) · 09f0957b
      Quentin Gliech authored
      This adds functions to transform a Twisted request to the
      `http::Request`, and then to send back an `http::Response` through it.
      
      It also imports the SynapseError exception so that we can throw that
      from Rust code directly
      
      Example usage of this would be:
      
      ```rust
      use crate::http::{http_request_from_twisted, http_response_to_twisted, HeaderMapPyExt};
      
      fn handler(twisted_request: &PyAny) -> PyResult<()> {
          let request = http_request_from_twisted(twisted_request)?;
      
          let ua: headers::UserAgent = request.headers().typed_get_required()?;
      
          if whatever {
              return Err((crate::errors::SynapseError::new(
                  StatusCode::UNAUTHORIZED,
                  "Whatever".to_owned
                  "M_UNAUTHORIZED",
                  None,
                  None,
              )));
          }
      
          let response = Response::new("hello".as_bytes());
          http_response_to_twisted(twisted_request, response)?;
      
          Ok(())
      }
      ```
      09f0957b
  14. Apr 17, 2024
  15. Apr 09, 2024
  16. Jan 23, 2024
  17. Jan 22, 2024
  18. Jan 08, 2024
    • Erik Johnston's avatar
      Port `EventInternalMetadata` class to Rust (#16782) · 5d3850b0
      Erik Johnston authored
      
      There are a couple of things we need to be careful of here:
      
      1. The current python code does no validation when loading from the DB,
      so we need to be careful to ignore such errors (at least on jki.re there
      are some old events with internal metadata fields of the wrong type).
      2. We want to be memory efficient, as we often have many hundreds of
      thousands of events in the cache at a time.
      
      ---------
      
      Co-authored-by: default avatarQuentin Gliech <quenting@element.io>
      5d3850b0
  19. Dec 01, 2023
  20. Nov 22, 2023
  21. Nov 21, 2023
  22. Oct 06, 2023
  23. Sep 28, 2023
    • Patrick Cloke's avatar
      Use modern config for maturin. (#16394) · c690fd16
      Patrick Cloke authored
      This allows maturin >= 0.15 to build the properly named
      shared library object.
      
      For now the old configuration is also kept to allow for
      older maturin installs to be used.
      c690fd16
  24. Sep 26, 2023
  25. Sep 05, 2023
  26. Aug 23, 2023
  27. Aug 02, 2023
  28. Jun 16, 2023
  29. Jun 12, 2023
  30. Jun 06, 2023
  31. May 04, 2023
  32. Apr 26, 2023
  33. Mar 07, 2023
  34. Mar 06, 2023
  35. Mar 03, 2023
  36. Mar 02, 2023
    • Patrick Cloke's avatar
      Update intentional mentions (MSC3952) to depend on... · 8ef324ea
      Patrick Cloke authored
      Update intentional mentions (MSC3952) to depend on `exact_event_property_contains` (MSC3966). (#15051)
      
      This replaces the specific `is_user_mention` push rule condition
      used in MSC3952 with the generic `exact_event_property_contains`
      push rule condition from MSC3966.
      8ef324ea
  37. Feb 28, 2023
    • Patrick Cloke's avatar
      Do not accept pattern_type from user input in push rules. (#15088) · e746f80b
      Patrick Cloke authored
      Internally the push rules module uses a `pattern_type` property for `event_match`
      conditions (and `related_event_match`) to mark the condition as matching the
      current user's Matrix ID or localpart.
      
      This is leaky to the Client-Server API where a user can successfully set a condition
      which provides `pattern_type` instead of `pattern` (note that there's no benefit to
      doing this -- the user can just use their own Matrix ID or localpart instead). When
      serializing back to the client the `pattern_type` property is converted into a proper
      `pattern`.
      
      The following changes are made to avoid this:
      
      * Separate the `KnownCondition::EventMatch` enum value into `EventMatch`
        and `EventMatchType`, each with their own expected properties. (Note that a
        similar change is made for `RelatedEventMatch`.)
      * Make it such that the `pattern_type` variants serialize to the same condition kind,
        but cannot be deserialized (since they're only provided by base rules).
      * As a final tweak, convert `user_id` vs. `user_localpart` values into an enum.
      e746f80b
Loading