summary refs log tree commit diff
path: root/rust (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add `event.internal_metadata.instance_name` (#17300)Eric Eastwood2024-06-131-0/+3
| | | | | | | | | | Add `event.internal_metadata.instance_name` (the worker instance that persisted the event) to go alongside the existing `event.internal_metadata.stream_ordering`. `instance_name` is useful to properly compare and query for events with a token since you need to compare both the `stream_ordering` and `instance_name` against the vector clock/`instance_map` in the `RoomStreamToken`. This is pre-requisite work and may be used in https://github.com/element-hq/synapse/pull/17293 Adding `event.internal_metadata.instance_name` was first mentioned in the initial Sliding Sync PR while pairing with @erikjohnston, see https://github.com/element-hq/synapse/pull/17187/commits/09609cb0dbca3a4cfd9fbf90cc962e765ec469c0#diff-5cd773fb307aa754bd3948871ba118b1ef0303f4d72d42a2d21e38242bf4e096R405-R410
* Update PyO3 to 0.21 (#17162)Erik Johnston2024-05-088-62/+90
| | | | | | | | | | This version change requires a migration to a new API. See https://pyo3.rs/v0.21.2/migration#from-020-to-021 This will fix the annoying warnings added when using the recent rust nightly: > warning: non-local `impl` definition, they should be avoided as they go against expectation
* Add support for MSC4115 (#17104)Richard van der Hoff2024-04-291-2/+7
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* MSC4108 implementation (#17056)Quentin Gliech2024-04-254-0/+412
| | | | | | Co-authored-by: Hugh Nimmo-Smith <hughns@element.io> Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Helpers to transform Twisted requests to Rust http Requests/Responses (#17081)Quentin Gliech2024-04-184-0/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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(()) } ```
* Bump minimum required Rust version to 1.66.0 (#17079)Quentin Gliech2024-04-171-1/+1
|
* #17039 Issue: Update base_rules.rs (#17043)Sumiran Pokharel2024-04-091-4/+4
| | | | Co-authored-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-237-0/+7
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Bump minimum Rust version to 1.65.0 (#16818)Erik Johnston2024-01-221-1/+1
| | | | | The ecosystem e.g. regex crate, have bumped up their MSRV to 1.65.0, which was released Nov 2022. In line with our policy, let's bump to match.
* Port `EventInternalMetadata` class to Rust (#16782)Erik Johnston2024-01-083-0/+473
| | | | | | | | | | | | | 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: Quentin Gliech <quenting@element.io>
* Merge remote-tracking branch 'gitlab/clokep/license-license' into new_developErik Johnston2023-12-137-91/+133
|\
| * Update license headersPatrick Cloke2023-11-217-91/+133
| |
* | ModuleAPI SSO auth callbacks (#15207)Andrew Yasinishyn2023-12-011-2/+1
| | | | | | Signed-off-by: Andrii Yasynyshyn yasinishyn.a.n@gmail.com
* | Bump pyo3 (0.20), pythonize (0.20), pyo3-log (0.9) (#16673)V024602023-11-221-3/+3
|/ | | Signed-off-by: Kai A. Hiller <V02460@gmail.com>
* Bump pyo3 from 0.17.1 to 0.19.2 (#16162)V024602023-10-062-3/+14
| | | Signed-off-by: Kai A. Hiller <V02460@gmail.com>
* Use modern config for maturin. (#16394)Patrick Cloke2023-09-281-0/+2
| | | | | | | 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.
* Add a cache around server ACL checking (#16360)Patrick Cloke2023-09-262-0/+104
| | | | | * Pre-compiles the server ACLs onto an object per room and invalidates them when new events come in. * Converts the server ACL checking into Rust.
* Implement MSC4028: push all encrypted events. (#16361)Patrick Cloke2023-09-264-1/+24
| | | | This unstable push rule is implemented behind an experimental configuration flag.
* Bump minimum supported Rust version to 1.61.0 (#16248)Erik Johnston2023-09-051-2/+7
|
* Stabilize support for MSC3958 (suppress notifications from edits). (#16113)Patrick Cloke2023-08-234-12/+2
|
* Update MSC3958 support to interact with intentional mentions. (#15992)Patrick Cloke2023-08-024-40/+44
| | | | | | | * Updates the rule ID. * Use `event_property_is` instead of `event_match`. This updates the implementation of MSC3958 to match the latest text from the MSC.
* push rules: fix internal conversion from _type to value (#15781)Mathieu Velten2023-06-161-2/+2
| | | Also fix wrong rule names for `is_user_mention` and `is_room_mention`.
* Bump minimum supported Rust version (#15768)Erik Johnston2023-06-121-1/+1
| | | | Important crates such as `log` and `regex` have bumped theirs to 1.60.0 as well.
* Stabilize support for MSC3952: Intentional mentions. (#15520)Patrick Cloke2023-06-064-19/+9
|
* Update the base rules to remove the dont_notify action. (MSC3987) (#15534)Patrick Cloke2023-05-043-8/+11
| | | | | A dont_notify action is a no-op (and coalesce is undefined). These are both considered no-ops by the spec, per MSC3987 and the predefined push rules were updated to remove dont_notify from the list of actions.
* Do not return extensible events experimental push rules by default. (#15494)Patrick Cloke2023-04-261-1/+4
|
* Stabilize support for MSC3873: disambuguated event push keys. (#15190)Patrick Cloke2023-03-071-3/+3
| | | | | | | This removes the experimental configuration option and always escapes the push rule condition keys. Also escapes any (experimental) push rule condition keys in the base rules which contain dot in a field name.
* Stabilize support for MSC3966: event_property_contains push condition. (#15187)Patrick Cloke2023-03-073-27/+7
| | | | This removes the configuration flag & updates the identifiers to use the stable version.
* Stabilize support for MSC3758: event_property_is push condition (#15185)Patrick Cloke2023-03-064-52/+32
| | | | This removes the configuration flag & updates the identifiers to use the stable version.
* Use nightly rustfmt in CI (#15188)Erik Johnston2023-03-032-1/+2
| | | | As we use some nightly only options, e.g. to group and sort imports consistently.
* Update intentional mentions (MSC3952) to depend on ↵Patrick Cloke2023-03-024-41/+50
| | | | | | | `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.
* Do not accept pattern_type from user input in push rules. (#15088)Patrick Cloke2023-02-284-186/+216
| | | | | | | | | | | | | | | | | | | | 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.
* Update intentional mentions (MSC3952) to depend on `exact_event_match` ↵Patrick Cloke2023-02-164-26/+5
| | | | | | | | | | (MSC3758). (#15037) This replaces the specific `is_room_mention` push rule condition used in MSC3952 with the generic `exact_event_match` push rule condition from MSC3758. No functionality changes due to this.
* Implement MSC3966: Add a push rule condition to search for a value in an ↵Patrick Cloke2023-02-143-29/+101
| | | | | | array. (#15045) The `exact_event_property_contains` condition can be used to search for a value inside of an array.
* Remove spurious `dont_notify` action from `.m.rule.reaction` (#15073)Richard van der Hoff2023-02-141-1/+1
| | | This does nothing and I want to remove it from the MSC.
* Update pyo3-log to v0.8.1 (#15043)V024602023-02-131-1/+1
| | | Signed-off-by: Kai A. Hiller <V02460@gmail.com>
* Support for MSC3758: exact_event_match push condition (#14964)Patrick Cloke2023-02-103-27/+190
| | | | | This specifies to search for an exact value match, instead of string globbing. It only works across non-compound JSON values (null, boolean, integer, and strings).
* Include no actions instead of dont_notify for suppressing edits. (#15016)Patrick Cloke2023-02-071-1/+1
|
* Implement MSC3958: suppress notifications from edits (#14960)Patrick Cloke2023-02-034-1/+27
| | | | | | | | Co-authored-by: Brad Murray <brad@beeper.com> Co-authored-by: Nick Barrett <nick@beeper.com> Copy the suppress_edits push rule from Beeper to implement MSC3958. https://github.com/beeper/synapse/blame/9415a1284b1bfb558bd66f28c24ca1611e6c6fa2/rust/src/push/base_rules.rs#L98-L114
* Support the backwards compatibility features in MSC3952. (#14958)Patrick Cloke2023-02-032-0/+23
| | | | If the feature is enabled and the event has a `m.mentions` property, skip processing of the legacy mentions rules.
* Reload the pyo3-log config when the Python logging config changes. (#14976)Patrick Cloke2023-02-031-2/+15
| | | | | | | | | | | Since pyo3-log is initialized very early in the Python start-up it caches the state of the loggers before they're fully initialized (and thus are essentially disabled). Whenever we reload the logging configuration we now also tell pyo3-log to discard any cached logging configuration it has; it will refetch the current logging configuration from Python at the next point it logs. This fixes Rust log lines not appearing in the homeserver logs.
* Make extension-module optional, but default. (#14965)Patrick Cloke2023-02-011-1/+5
|
* Fix inconsistencies between MSC3952 and implementation. (#14957)Patrick Cloke2023-02-011-3/+3
| | | | * Correct the push rule IDs. * Removes the sound tweak for room notifications.
* Fix running cargo bench & test in CI. (#14943)Patrick Cloke2023-01-311-0/+10
|
* Implement MSC3952: Intentional mentions (#14823)Patrick Cloke2023-01-273-2/+78
| | | | | | | | MSC3952 defines push rules which searches for mentions in a list of Matrix IDs in the event body, instead of searching the entire event body for display name / local part. This is implemented behind an experimental configuration flag and does not yet implement the backwards compatibility pieces of the MSC.
* Implement MSC3930: polls push rules (#14787)Andrew Morgan2023-01-194-8/+97
|
* Fix Rust lint CI (#14602)Erik Johnston2022-12-022-15/+23
|
* Support MSC1767's `content.body` behaviour; Add base rules from MSC3933 (#14524)Travis Ralston2022-11-283-1/+278
| | | | | | | | | | | * Support MSC1767's `content.body` behaviour in push rules * Add the base rules from MSC3933 * Changelog entry * Flip condition around for finding `m.markup` * Remove forgotten import
* Create MSC1767 (extensible events) room version; Implement MSC3932 (#14521)Travis Ralston2022-11-281-1/+96
| | | | | | | | | | | | * Add MSC1767's dedicated room version, based on v10 * Only enable MSC1767 room version if the config flag is on Using a similar technique to knocking: https://github.com/matrix-org/synapse/pull/6739/files#diff-3af529eedb0e00279bafb7369370c9654b37792af8eafa0925400e9281d57f0a * Support MSC3932: Extensible events room version feature flag * Changelog entry
* Initial support for MSC3931: Room version push rule feature flags (#14520)Travis Ralston2022-11-282-0/+42
| | | | | | | * Add support for MSC3931: Room Version Supports push rule condition * Create experimental flag for future work, and use it to gate MSC3931 * Changelog entry
* Make Dependabot only bump Rust deps in the lock file (#14434)Erik Johnston2022-11-141-6/+6
| | | This is to help downstream packagers.
* Bump blake2 from 0.10.4 to 0.10.5 (#14426)dependabot[bot]2022-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | * Bump blake2 from 0.10.4 to 0.10.5 Bumps [blake2](https://github.com/RustCrypto/hashes) from 0.10.4 to 0.10.5. - [Release notes](https://github.com/RustCrypto/hashes/releases) - [Commits](https://github.com/RustCrypto/hashes/compare/blake2-v0.10.4...blake2-v0.10.5) --- updated-dependencies: - dependency-name: blake2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Changelog Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
* Bump pyo3 from 0.17.2 to 0.17.3 (#14381)dependabot[bot]2022-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * Bump pyo3 from 0.17.2 to 0.17.3 Bumps [pyo3](https://github.com/pyo3/pyo3) from 0.17.2 to 0.17.3. - [Release notes](https://github.com/pyo3/pyo3/releases) - [Changelog](https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md) - [Commits](https://github.com/pyo3/pyo3/compare/v0.17.2...v0.17.3) --- updated-dependencies: - dependency-name: pyo3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Changelog Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
* Bump regex from 1.6.0 to 1.7.0 (#14380)dependabot[bot]2022-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * Bump regex from 1.6.0 to 1.7.0 Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.6.0...1.7.0) --- updated-dependencies: - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Changelog Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
* Implementation for MSC3664: Pushrules for relations (#11804)DeepBlueV7.X2022-10-253-10/+167
|
* Bump serde_json from 1.0.86 to 1.0.87 (#14279)dependabot[bot]2022-10-241-1/+1
|
* Bump anyhow from 1.0.65 to 1.0.66 (#14278)dependabot[bot]2022-10-241-1/+1
|
* Bump serde from 1.0.145 to 1.0.147 (#14277)dependabot[bot]2022-10-241-1/+1
|
* Remove the experimental implementation of MSC3772. (#14094)Patrick Cloke2022-10-123-151/+11
| | | MSC3772 has been abandoned.
* Disable pushing for server ACL events (MSC3786). (#13997)Patrick Cloke2022-10-042-10/+1
| | | | | | Switches to the stable identifier for MSC3786 and enables it by default. This disables pushes of m.room.server_acl events.
* Implement push rule evaluation in Rust. (#13838)Erik Johnston2022-09-298-10/+803
|
* Merge branch 'release-v1.68' into developErik Johnston2022-09-231-1/+1
|\
| * Lower minimum rustc version to 1.58.1 (#13857)Erik Johnston2022-09-211-1/+1
| |
* | Port the push rule classes to Rust. (#13768)Erik Johnston2022-09-204-2/+854
|/
* Check if Rust lib needs rebuilding. (#13759)Erik Johnston2022-09-123-1/+58
| | | This protects against the common mistake of failing to remember to rebuild Rust code after making changes.
* Add rust to CI (#13763)Erik Johnston2022-09-091-0/+1
|
* Add a stub Rust crate (#12595)Erik Johnston2022-09-062-0/+36