Compare commits

...
Author SHA1 Message Date
timedout a535449f15 chore: Release 2026-11-10 20:12:29 +00:00
timedout 7e3022f6ae chore: Add changelog frags 2026-11-10 20:11:33 +00:00
timedout c7dc06c693 fix: SEC34
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
Reviewed-By: Jacob Taylor <jacob@explodie.org>
2026-11-10 20:07:18 +00:00
timedout 52562c4227 fix: SEC15
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-11-10 19:23:24 +00:00
timedout e9d0737e50 fix: SEC31
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-11-10 19:22:51 +00:00
Henry-HilesandGinger 005ee45feb fix: SEC39
Reviewed-By: timedout <git@nexy7574.co.uk>
Co-Authored-By: Ginger <ginger@gingershaped.computer>
2026-11-10 19:22:15 +00:00
timedout 46f71d55f7 fix: SEC36
Reviewed-By: Jacob Taylor <jacob@explodie.org>
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-11-10 19:20:08 +00:00
timedout 046074bbc2 chore: Release 2026-09-28 02:04:54 +01:00
timedout 550dd0160a fix: SEC8
Reviewed-By: Ginger <ginger@gingershaped.computer>
Reviewed-By: Jade <jade@ellis.link>
Reviewed-By: Jacob Taylor <jacob@explodie.org>
2026-09-28 02:00:37 +01:00
timedout c0ad864d57 fix: Make unembed unsigned run in bg 2026-09-27 22:58:08 +01:00
timedout 451c44800b chore: Add news frag 2026-09-27 19:19:50 +01:00
timedout a61026912c feat: Add a migration to fix up unsigned data 2026-09-27 18:31:46 +01:00
timedout 05d6922351 style: Take an optional context instead of deconstructed parameters 2026-09-27 17:33:26 +01:00
timedout f0a0596d12 fix: Remove undocumented prev_sender unsigned field 2026-09-27 17:32:47 +01:00
timedout fbedf994db fix: Don't unnecessarily embed prev_content in populate_unsigned 2026-09-27 17:32:47 +01:00
timedout 1de16fed9e style: English is a difficult language 2026-09-27 17:32:47 +01:00
timedout 4812837d13 fix: Don't allow set_unsigned to panic
While an error in this function is probably bad, detonating a metric tonne of TNT on the call tree is probably worse
2026-09-27 17:32:47 +01:00
timedout 90793eaaf4 fix: Actually set unsigned in PDU after set_unsigned 2026-09-27 17:32:47 +01:00
timedout 744928b206 style: Update docstring for Pdu.set_unsigned 2026-09-27 17:32:47 +01:00
timedout 05ee24df7d fix: Move helper to helpers.rs, rename field, don't recurse unsigned in redacted_because
Renamed `redacted_because_id` to `org.continuwuity.redacted_by` for proper namespacing; `get_unsigned_context` now lives in helpers.rs instead of `mod.rs`. The helper function also now explicitly wipes `unsigned` for `redacted_because` to avoid leaks (see comment).
2026-09-27 17:32:46 +01:00
timedout 89eecd2bf7 fix: Record redacted_because_id instead of redacted_because 2026-09-27 17:32:46 +01:00
timedout b2072baf59 perf: Strip unsigned over federation and generate it on the fly locally 2026-09-27 17:32:46 +01:00
timedout 286897de88 feat: Don't send unsigned data over federation 2026-09-27 17:32:46 +01:00
stratself 3ee4ab7c09 chore: Add changelog for #2259 2026-09-26 23:03:21 +00:00
stratself 173091624c docs(styling): Use lighter colors for nav bars in dark mode 2026-09-26 23:03:21 +00:00
stratself 0f21f42787 docs(landing): Style action buttons to add punch and match c10y's themes
The buttons are an attempt to match colors found on c10y's account
management landing page. With less round corners and a punchier color
scheme they should be more visible than previous versions (which were
reported to be a bit dull)

The donation button is stylized in green
2026-09-26 23:03:21 +00:00
stratself 31a0c4c9b5 docs: Add OpenCollective link and donate button 2026-09-26 23:03:21 +00:00
stratself 8d60b8dada docs: Stricter shortcut link redirections
Avoids some recursion and 404 endpoint issues. Serves as good
examples for future additions.

The "Intermittent federation failures to a specific server"
section is now ID'd as #intermittent for easier reachability.
2026-09-26 23:01:15 +00:00
Renovate Bot 84222bfc7b chore(deps): update rust crate smallvec to v1.16.2 2026-09-26 05:04:12 +00:00
Renovate Bot a4d2d4a720 chore(deps): update rust-zerover-patch-updates 2026-09-25 05:02:56 +00:00
Renovate BotandGinger 02d245afe5 chore(deps): Update ruma digest to e7384f0
Co-authored-by: Ginger <ginger@gingershaped.computer>
2026-09-24 14:16:55 -04:00
Renovate Bot 3e5ea8f850 chore(deps): update node-patch-updates to v2.0.22 2026-09-24 14:11:17 +00:00
Renovate Bot 5878594698 chore(deps): update dependency node to v24 2026-09-24 14:11:11 +00:00
Renovate Bot 4e8643147d chore(deps): update rust-non-major 2026-09-24 13:57:09 +00:00
Ginger 4ea4e15edb chore: Reformat with latest nightly 2026-09-24 09:53:59 -04:00
Erwan Leboucher cee69b4c8d fix: Walk auth events once instead of re-queueing parents 2026-09-22 21:19:25 +02:00
Renovate Bot 457b884491 chore(deps): update github-actions-digest 2026-09-22 05:03:35 +00:00
timedout d3ed175264 fix(stateres): Inject dummy create event when none is available
I'm not sure how this doesn't cause more panics. When running an auth check on the create event during iterative auth checks, there's obviously no create event in the base state nor auth map, so the call to fetch_state() will return nothing and thus panic.
This just inserts the incoming event if it's a create event and there isn't an existing one in the auth state. It's not used for the create event checks anyway so this has no effect aside from plugging the panic.
2026-09-22 02:04:39 +01:00
timedout 7924e96589 chore: add todo to fix 2026-09-22 00:16:27 +00:00
timedout d1b1274900 style: Unchain if statement 2026-09-22 00:16:27 +00:00
timedout 6299df3552 style: Document fetch_and_handle_auth_events control flow 2026-09-22 00:16:27 +00:00
Erwan Leboucher 20d146bd5e fix: Throttle client-triggered remote event fetches 2026-09-22 00:16:27 +00:00
Erwan Leboucher 03f60c7002 fix: Don't re-fetch auth events that can never be resolved 2026-09-22 00:16:27 +00:00
Erwan Leboucher ed1e634579 feat(push): Add MSC4174 web push 2026-09-21 23:35:05 +00:00
Renovate Bot dbcffe8af0 chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.104.2 2026-09-21 05:02:42 +00:00
timedout 8891adfba3 fix(stateres): Enforce state ownership checks against creators too
Previously being a room creator short-circuited the `can_send_event`
check, which allowed creators to send state events "owned" (state key
starting with @ but not being the sender's user ID), in effect skipping
auth check 9 in v12 rooms. This removes that short circuit condition,
since `Infinite < Int` always returns false anyway, allowing the state
key check block to execute.

Fixes #2266
2026-09-18 18:57:57 +01:00
Renovate Bot 4c8dc59f7a chore(deps): update rust-non-major 2026-09-17 05:03:15 +00:00
timedout 1a8e5ccc09 fix: Gracefully handle extremityless rooms when gapfilling
See also: #2259
2026-09-17 00:06:17 +01:00
timedout c8720a6ebc chore: Update admin room announcement 2026-09-16 22:12:25 +01:00
timedout a237672c90 chore: Release 2026-09-16 19:37:06 +01:00
Allinen d52d5003b1 refactor: cleaned up code 2026-09-16 17:57:11 +00:00
Allinen 7026f62ff8 chore: added changelog.d 2026-09-16 17:57:11 +00:00
Allinen bdaa78340e style: fix typo 2026-09-16 17:57:11 +00:00
Allinen 89e07ae239 feat(config): connection_uri_file added to config 2026-09-16 17:57:11 +00:00
Jade ffcf152016 revert d330930bb5
revert feat: Add timestamp to event endpoint

This implementation unfortunately resulted in resource exhaustion when run on some rooms.
2026-09-16 13:05:45 +00:00
Renovate Bot 32a36f56c7 chore(deps): update pre-commit hook crate-ci/typos to v1.50.2 2026-09-16 05:03:57 +00:00
Renovate Bot 0e3dbb149c chore(deps): update rust crate rustls to v0.23.45 2026-09-15 16:24:21 +00:00
Renovate Bot 85a600a466 chore(deps): update github-actions-digest 2026-09-15 05:01:33 +00:00
timedout 77d47f268e fix(stateres): Don't panic when the create event goes missing
I have no idea how this can even happen and frankly I'm scared to look
however that's a problem for another time.
Panicking causes entire transactions to explode, this just makes one
event explode.
2026-09-14 18:14:22 +01:00
Renovate Bot 5e7cb169ae chore(deps): update rust crate serde-saphyr to v1 2026-09-14 12:53:59 +00:00
Renovate Bot 7d8a3ba167 chore(deps): lock file maintenance 2026-09-14 12:53:27 +00:00
Renovate Bot 0299297232 chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.83.2 2026-09-14 05:04:11 +00:00
timedout 5f31f3fb10 Merge remote-tracking branch 'origin/main' into lake/feature/shear-unused-deps 2026-09-13 19:57:41 +01:00
Erwan Leboucher ac8b17db1b fix: Only count non-outlier prev_events in get_missing_events assertion 2026-09-13 18:50:38 +00:00
Erwan Leboucher 9bb203abe8 fix(sync): Omit empty room account data from sliding sync responses 2026-09-13 18:50:26 +00:00
Lake 8ab842b198 deps: shear the dependencies again 2026-09-12 15:07:42 -05:00
Lake 439f266d8f chore: resolve conflicts with main 2026-09-12 15:07:35 -05:00
Henry-Hiles 5117b104af fix: don't allow calling update-flake-hashes manually
Fixes #1862.
2026-09-12 15:00:01 -04:00
ginger c6f2c5eb39 fix: Log new password when using reset-password --convert-to-local-account 2026-09-12 16:23:46 +00:00
Henry-Hiles 7e2e033e4e chore: Bump Nix flake lock 2026-09-12 16:05:41 +00:00
Henry-Hiles b221a49b77 chore: upgrade argon2 2026-09-11 16:13:03 -04:00
Jade Ellis 71e101a4dc style: Run formatting 2026-09-11 15:54:42 +01:00
Erwan Leboucher 031039e879 chore(complement): Remove workflow 2026-09-11 14:48:35 +00:00
Erwan Leboucher 749c3f58d0 feat(complement): Load test image archives 2026-09-11 14:48:35 +00:00
Erwan Leboucher e48fe5bc4b feat(complement): Simplify local test runs 2026-09-11 14:48:35 +00:00
Jade Ellis 0f97eea31f style: Run formatting 2026-09-11 15:39:54 +01:00
Erwan Leboucher d330930bb5 feat: Add timestamp to event endpoint 2026-09-11 14:22:11 +00:00
stratself 272f93a634 chore: Add detailed changelog on turning legacy media off 2026-09-11 14:21:08 +00:00
stratself 5fbd4914ca fix: Disable unauthenticated media by default 2026-09-11 14:21:08 +00:00
Erwan Leboucher 6c6e8e72af chore: Add changelog entry 2026-09-11 14:17:45 +00:00
Erwan Leboucher aa92bf8814 fix(federation): Read the backoff window once when gating requests 2026-09-11 14:17:45 +00:00
Erwan Leboucher 9d7c8be390 fix(sender): Only claim a destination when the send is allowed 2026-09-11 14:17:45 +00:00
Ginger 644d247007 fix: Size background gradient relative to the viewport 2026-09-11 14:14:39 +00:00
Ginger 32c8ff5b1b feat: Show profile banners in web UI 2026-09-11 14:14:39 +00:00
Renovate Bot f95292a83e chore(deps): update rust crate base64 to 0.23.0 2026-09-11 14:10:10 +00:00
Renovate Bot 13a2f5f2d5 chore(deps): update rust-zerover-patch-updates 2026-09-11 14:06:47 +00:00
Renovate Bot a539977816 chore(deps): update dependency cargo-bins/cargo-binstall to v1.23.0 2026-09-11 14:05:56 +00:00
Henry-Hiles a11fc97800 fix(nix): use new isLinux flag
Fixes a deprecation warning from nix
2026-09-11 14:05:46 +00:00
Lake a0f8c818f3 chore(git): ignore web/Cargo.toml reformat in blame 2026-07-17 17:02:21 -05:00
Lake 2717ce9a76 chore: write news fragment for #1976 2026-07-17 17:02:21 -05:00
Lake 7d3d421564 ci: run 'cargo shear' 2026-07-17 17:02:21 -05:00
Lake 75b725908a style(web): format Cargo.toml 2026-07-17 17:02:21 -05:00
Lake bb8703e0f0 build: shear unused dependencies 2026-07-17 17:02:20 -05:00
142 changed files with 5807 additions and 2441 deletions

No files matched your search

@@ -52,7 +52,7 @@ runs:
- name: Set up Docker Buildx
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
with:
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
@@ -67,7 +67,7 @@ runs:
uses: ./.forgejo/actions/rust-toolchain
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
with:
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
@@ -75,7 +75,7 @@ runs:
- name: Set up QEMU
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4
- name: Login to builtin registry
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
+8
View File
@@ -189,6 +189,13 @@ runs:
cargo-binstall -y --no-symlinks timelord-cli
echo "::endgroup::"
fi
if command -v cargo-shear &> /dev/null; then
echo "✅ cargo-shear already available"
else
echo "::group::📦 Installing cargo-shear"
cargo binstall -y --no-symlinks cargo-shear
echo "::endgroup::"
fi
- name: Configure sccache environment
shell: bash
@@ -214,3 +221,4 @@ runs:
echo " Cargo: $(cargo --version)"
echo " prek: $(prek --version 2>/dev/null || echo 'installed')"
echo " timelord: $(timelord --version 2>/dev/null || echo 'installed')"
echo " cargo-shear: $(cargo-shear --version 2>/dev/null || echo 'installed')"
+1 -1
View File
@@ -71,7 +71,7 @@ runs:
- name: Install timelord-cli and git-warp-time
if: steps.check-binaries.outputs.need-install == 'true'
uses: https://github.com/taiki-e/install-action@d438492cf8a250514fa2d34b30bc3c0dc37c65ff # v2
uses: https://github.com/taiki-e/install-action@94c31af3204a9f15ab40b35ad084410b905bbc73 # v2
with:
tool: git-warp-time,timelord-cli@3.0.1
+1 -1
View File
@@ -34,7 +34,7 @@ jobs:
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
uses: https://github.com/actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 22
node-version: 24
- name: Cache npm dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
# repositories: continuwuity
- name: Install regsync
uses: https://github.com/regclient/actions/regsync-installer@ba687069a65d03e9214808f16f3f0b3933c2048b # main
uses: https://github.com/regclient/actions/regsync-installer@bb562fac724b7b37c17f19671df07fe34fabc376 # main
- name: Check what images need mirroring
run: |
+3
View File
@@ -104,3 +104,6 @@ jobs:
--profile test \
--all-targets \
--no-fail-fast
- name: Check for unused dependencies
run: cargo shear
+2 -2
View File
@@ -62,7 +62,7 @@ jobs:
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push Docker image by digest
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
file: "docker/Dockerfile"
@@ -150,7 +150,7 @@ jobs:
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push max-perf Docker image by digest
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
file: "docker/Dockerfile"
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
name: Renovate
runs-on: ubuntu-latest
container:
image: ghcr.io/renovatebot/renovate:44.65.5@sha256:bf23a3576316adc6c678a162fb0297d5c11a8f02606c1bc8042aa2f071f3773c
image: ghcr.io/renovatebot/renovate:44.104.2@sha256:d19051d0a908e098c7fbba04a16435ef136208bfa47105d59a9fe47059e2bd25
options: --tmpfs /tmp:exec
steps:
- name: Checkout
@@ -1,7 +1,6 @@
name: Update flake hashes
on:
workflow_dispatch:
pull_request:
paths:
- "Cargo.lock"
+1
View File
@@ -9,3 +9,4 @@ f419c64aca300a338096b4e0db4c73ace54f23d0
46c193e74b2ce86c48ce802333a0aabce37fd6e9
# rustfmt update that rewrapped tons of comments
9fbabe221051e6956a05d8824142092ede68971e
b0c0905472b882ff0cc79232e73d307fd0b5035b
+18 -30
View File
@@ -10,31 +10,31 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-merge-conflict
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-merge-conflict
- id: check-added-large-files
- repo: https://github.com/crate-ci/typos
rev: v1.50.1
rev: v1.50.2
hooks:
- id: typos
- id: typos
name: commit-msg-typos
stages: [commit-msg]
stages: [ commit-msg ]
- repo: https://github.com/crate-ci/committed
rev: v1.1.11
hooks:
- id: committed
- id: committed
- repo: local
hooks:
@@ -42,10 +42,10 @@ repos:
name: cargo fmt
entry: cargo +nightly fmt --
language: system
types: [rust]
types: [ rust ]
pass_filenames: false
stages:
- pre-commit
- pre-commit
- repo: local
hooks:
@@ -54,18 +54,6 @@ repos:
entry: cargo clippy -- -D warnings
language: system
pass_filenames: false
types: [rust]
types: [ rust ]
stages:
- pre-push
- repo: local
hooks:
- id: docs-build
name: docs build
entry: npm run docs:build
language: system
pass_filenames: false
files: docs/
types: [mdx]
stages:
- pre-commit
+3 -2
View File
@@ -2,7 +2,6 @@
extend-exclude = ["*.csr", "*.lock", "pnpm-lock.yaml"]
[default]
extend-ignore-re = [
"(?Rm)^.*(#|//|<!--)\\s*spellchecker:disable-line(\\s*-->)$", # Ignore a line by making it trail with a `spellchecker:disable-line` comment
"^[0-9a-f]{7,}$", # Commit hashes
@@ -14,7 +13,9 @@ extend-ignore-re = [
"\\$[A-Z0-9+][A-Za-z0-9+]{6,}[a-z0-9+]",
"\\b[a-z0-9+/=][A-Za-z0-9+/=]{7,}[a-z0-9+/=][A-Z]\\b",
# In the renovate config
".ontainer"
".ontainer",
# Allow RDNS identifiers
"([A-Za-z0-9]+)\\.[A-Za-z0-9.]+"
]
[default.extend-words]
+64
View File
@@ -1,3 +1,67 @@
# Continuwuity v26.9.2 (2026-11-10)
## Bugfixes
- SEC15, reported by @stratself (SEC15)
- SEC31, reported by @tulir (SEC31)
- SEC34, reported by @jade (SEC34)
- SEC36, reported by @nex (SEC36)
- SEC39, reported by @Henry-Hiles (SEC39)
# Continuwuity v26.9.1 (2026-09-28)
## Features
- The server now calculates some data for `unsigned` data when sending it to clients, rather than embedding it at rest. This brings decreased storage costs and improved access control checks.
Contributed by @nex. ([#2270](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2270))
- Added encrypted Web Push ([MSC4174](https://github.com/matrix-org/matrix-spec-proposals/pull/4174)), enabled by default. Contributed by @eleboucher.
## Bugfixes
- Fixed exponential blowup in auth event fetching for deep auth chains, which caused runaway CPU and RAM until restart. Contributed by @eleboucher. (auth-event-walk)
- Fixed events being repeatedly re-requested over federation when they were fetched successfully but could not be resolved, and throttled remote event fetches made on behalf of clients. Contributed by @eleboucher. ([#2090](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2090))
## Improved Documentation
- Add Open Collective links to docs and restyle action buttons. Contributed by @stratself ([#2269](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2269))
# Continuwuity v26.9.0 (2026-09-16)
## Features
- Added connection_uri_file to configuration options ([#1790](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1790))
- Removed the ability to run a server with "challengeless registration" (i.e. the big scary long config option, with no captcha, email, or registration token requirements), without manually compiling
the server with non-default arguments. Contributed by @nex.
(This is part of a wider effort to reduce abuse in the Matrix network, of which servers that are easily automated cause a disproportionate amount of) ([#2189](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2189))
- Disable legacy, unauthenticated media (`allow_legacy_media`) by default as the Matrix ecosystem has completely sunsetted this functionality. Legacy media allows anyone to access a file just by knowing its URL, thereby turning homeservers into unwitting CDNs. Homeserver admins are strongly encouraged to check and turn off this option. ([#2225](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2225))
- Added the `provider_name` and `provider_icon` OIDC options, which show the identity provider's name and icon on the web login page. Contributed by @eleboucher.
- Advertised MatrixRTC ([MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143)) support in `/_matrix/client/versions`. Contributed by @eleboucher.
- The account management web UI now shows users' [MSC4427](https://github.com/matrix-org/matrix-spec-proposals/pull/4427) profile banners. Contributed by @ginger.
## Bugfixes
- Fixed simplified Sliding Sync lists returning rooms out of activity order. Contributed by @eleboucher. (sliding-sync-activity-ordering)
- Fixed simplified Sliding Sync restarting when overlapping sync responses arrive out of order. Contributed by @eleboucher. (sliding-sync-overlapping-responses)
- Fixed simplified Sliding Sync re-sending rooms in full after a list's window shrinks and grows again. Contributed by @eleboucher. (sliding-sync-window-positions)
- Fixed [MSC4155](https://github.com/matrix-org/matrix-spec-proposals/pull/4155) invite filtering being applied to outgoing invites, which prevented users from inviting anyone they had blocked or ignored invites from. Contributed by @eleboucher. (msc4155-outbound-invites)
- Fixed `!admin query pusher delete-all-user` reporting success without deleting any pushers. Contributed by @eleboucher. ([#1726](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1726))
- Removing a device from the web UI will no longer show a "Back" link pointing to a 404. Contributed by @ginger. ([#2062](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2062))
- Fixed simplified sliding sync omitting device list updates for rooms with only timeline changes. Contributed by @eleboucher. ([#2175](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2175))
- Fixed federation transactions never being sent to a remote that was put into backoff by an unrelated request. Contributed by @eleboucher. ([#2188](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2188))
- Re-added a cooldown when fetching events from remote servers that have previously failed to be pulled, preventing request spam. ([#2201](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2201))
- One-time keys and fallback keys are now properly cleaned up when a device is deleted. ([#2202](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2202))
- Sliding sync responses no longer include an empty room account data entry for every room in a list's range. Contributed by @eleboucher. ([#2226](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2226))
- Fixed the space hierarchy endpoints returning non-suggested `m.space.child` events in `children_state` when `suggested_only` was requested. Contributed by @eleboucher.
- The account deactivation page in the account management web UI now shows a message when OIDC is enabled instead of prompting users for a nonexistent account password.
## Misc
- #1976
# Continuwuity v26.8.1 (2026-08-22)
No significant changes.
+2 -1
View File
@@ -75,7 +75,7 @@ cargo +nightly fmt
### Matrix tests
Continuwuity uses [Complement][complement] for Matrix protocol compliance testing. Complement tests are run manually by developers, and documentation on how to run these tests locally is currently being developed.
Continuwuity uses [Complement][complement] for Matrix protocol compliance testing. Complement tests are run manually by developers; see the [local testing instructions][complement-testing].
If your changes are done to fix Matrix tests, please note that in your pull request. If more Complement tests start failing from your changes, please review the logs and determine if they're intended or not.
@@ -174,6 +174,7 @@ continuwuity Matrix rooms for Code of Conduct violations.
[issues]: https://forgejo.ellis.link/continuwuation/continuwuity/issues
[continuwuity-matrix]: https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org
[complement]: https://github.com/matrix-org/complement/
[complement-testing]: docs/development/testing.mdx#complement
[sytest]: https://github.com/matrix-org/sytest/
[nodejs-download]: https://nodejs.org/en/download
[rspress]: https://rspress.rs/
Generated
+836 -500
View File
File diff suppressed because it is too large. Load diff
+24 -20
View File
@@ -12,7 +12,7 @@ license = "Apache-2.0"
# See also `rust-toolchain.toml`
readme = "README.md"
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
version = "26.8.1"
version = "26.9.2"
[workspace.metadata.crane]
name = "conduwuit"
@@ -58,7 +58,7 @@ features = ["parse", "serde"]
version = "0.6.0"
[workspace.dependencies.base64]
version = "0.22.1"
version = "0.23.0"
default-features = false
# used for TURN server authentication
@@ -66,6 +66,15 @@ default-features = false
version = "0.13.0"
default-features = false
[workspace.dependencies.web-push-native]
version = "0.5.0"
default-features = false
[workspace.dependencies.p256]
version = "0.13.2"
default-features = false
features = ["ecdsa", "std"]
# used for checking if an IP is in specific subnets / CIDR ranges easier
[workspace.dependencies.ipaddress]
version = "0.2.0"
@@ -83,6 +92,10 @@ version = "0.1.3"
[workspace.dependencies.http]
version = "1.3.1"
# parses the HTTP-date form of Retry-After
[workspace.dependencies.httpdate]
version = "1.0.3"
[workspace.dependencies.regex]
version = "1.11.1"
@@ -164,20 +177,16 @@ features = ["raw_value"]
# Used for appservice registration files
[workspace.dependencies.serde-saphyr]
version = "0.0.29"
version = "1.0.0"
# Used to load forbidden room/user regex from config
[workspace.dependencies.serde_regex]
version = "1.1.0"
# Used for ruma wrapper
[workspace.dependencies.serde_html_form]
version = "0.4.0"
# Used for password hashing
[workspace.dependencies.argon2]
version = "0.5.3"
features = ["alloc", "rand"]
version = "0.6.0"
features = ["alloc", "getrandom"]
default-features = false
# Used to generate thumbnails for images
@@ -309,11 +318,6 @@ features = [
version = "2.0.12"
default-features = false
# Used when hashing the state
[workspace.dependencies.ring]
version = "0.17.14"
default-features = false
# Used to make working with iterators easier, was already a transitive depdendency
[workspace.dependencies.itertools]
version = "0.15.0"
@@ -343,7 +347,7 @@ version = "1.1.1"
# Used for matrix spec type definitions and helpers
[workspace.dependencies.ruma]
git = "https://github.com/ruma/ruma.git"
rev = "83d80c8d869e0ba09becbf7e7378eefc7377cfdb"
rev = "e7384f01eacd454c593683de50491201e2160fd1"
features = [
"appservice-api-c",
"client-api",
@@ -650,11 +654,6 @@ package = "conduwuit_build_metadata"
path = "src/build_metadata"
default-features = false
[workspace.dependencies.conduwuit]
package = "conduwuit"
path = "src/main"
[workspace.dependencies.ruminuwuity]
package = "ruminuwuity"
path = "src/ruminuwuity"
@@ -976,6 +975,8 @@ let_underscore_future = { level = "allow", priority = 1 }
# rust doesnt understand conduwuit's custom log macros
literal_string_with_formatting_args = { level = "allow", priority = 1 }
# This lint is stupid, there's no point defining generics for simple trait params
impl-trait-in-params = { level = "allow", priority = 1 }
needless_raw_string_hashes = "allow"
@@ -984,3 +985,6 @@ collapsible_if = "allow"
# TODO: break these apart
cognitive_complexity = "allow"
[workspace.metadata.cargo-shear]
ignored = ["const-str", "ctor", "dtor"]
+127 -23
View File
@@ -2,14 +2,54 @@
set -euo pipefail
# The root path where complement is available.
COMPLEMENT_SRC="${COMPLEMENT_SRC:-$1}"
toplevel="$(git rev-parse --show-toplevel)"
DEFAULT_COMPLEMENT_SRC="$toplevel/target/complement"
DEFAULT_COMPLEMENT_REVISION="6d2fdc286c2b44faaddd1037205869b2242a4005"
# A `.jsonl` file to write test logs to
LOG_FILE="${2:-tests/test_results/complement/test_logs.jsonl}"
MSC="${COMPLEMENT_MSC:-}"
IMAGE_ARCHIVE=""
while [ "$#" -gt 0 ]; do
case "$1" in
--msc)
if [ "$#" -lt 2 ]; then
echo "--msc requires an MSC number"
exit 2
fi
MSC="$2"
shift 2
;;
--image)
if [ "$#" -lt 2 ]; then
echo "--image requires a path to a Docker image archive"
exit 2
fi
IMAGE_ARCHIVE="$2"
shift 2
;;
*)
break
;;
esac
done
# A `.jsonl` file to write test results to
RESULTS_FILE="${3:-tests/test_results/complement/test_results.jsonl}"
if [ -n "$MSC" ]; then
MSC="${MSC#MSC}"
MSC="${MSC#msc}"
if ! [[ "$MSC" =~ ^[0-9]+$ ]]; then
echo "--msc must be an MSC number, for example: --msc 3391"
exit 2
fi
fi
# The root path where Complement is available.
if [ -n "${COMPLEMENT_SRC:-}" ]; then
LOG_FILE="${1:-tests/test_results/complement/test_logs.jsonl}"
RESULTS_FILE="${2:-tests/test_results/complement/test_results.jsonl}"
else
COMPLEMENT_SRC="${1:-$DEFAULT_COMPLEMENT_SRC}"
LOG_FILE="${2:-tests/test_results/complement/test_logs.jsonl}"
RESULTS_FILE="${3:-tests/test_results/complement/test_results.jsonl}"
fi
# The base docker image to use for complement tests
# You can build the default with `docker build -t continuwuity:complement -f ./docker/complement.Dockerfile .`
@@ -19,45 +59,107 @@ COMPLEMENT_BASE_IMAGE="${COMPLEMENT_BASE_IMAGE:-continuwuity:complement}"
# Complement tests that are skipped due to flakiness/reliability issues or we don't implement such features and won't for a long time
SKIPPED_COMPLEMENT_TESTS='TestPartialStateJoin.*|TestRoomDeleteAlias/Parallel/Regular_users_can_add_and_delete_aliases_when_m.*|TestRoomDeleteAlias/Parallel/Can_delete_canonical_alias|TestUnbanViaInvite.*|TestRoomState/Parallel/GET_/publicRooms_lists.*"|TestRoomDeleteAlias/Parallel/Users_with_sufficient_power-level_can_delete_other.*'
# $COMPLEMENT_SRC needs to be a directory to Complement source code
if [ -f "$COMPLEMENT_SRC" ]; then
echo "\$COMPLEMENT_SRC must be a directory/path to Complement source code"
# Download the pinned upstream Complement checkout on first use. A local
# checkout can be supplied as the first argument or with COMPLEMENT_SRC.
if [ ! -e "$COMPLEMENT_SRC" ]; then
mkdir -p "$(dirname "$COMPLEMENT_SRC")"
git init --quiet "$COMPLEMENT_SRC"
git -C "$COMPLEMENT_SRC" remote add origin https://github.com/matrix-org/complement.git
git -C "$COMPLEMENT_SRC" fetch --depth 1 origin "$DEFAULT_COMPLEMENT_REVISION"
git -C "$COMPLEMENT_SRC" checkout --quiet --detach FETCH_HEAD
fi
if [ ! -d "$COMPLEMENT_SRC" ] || [ ! -f "$COMPLEMENT_SRC/go.mod" ]; then
echo "\$COMPLEMENT_SRC must be a directory containing Complement source code"
exit 1
fi
# quick test to make sure we can actually write to $LOG_FILE and $RESULTS_FILE
touch $LOG_FILE && rm -v $LOG_FILE
touch $RESULTS_FILE && rm -v $RESULTS_FILE
toplevel="$(git rev-parse --show-toplevel)"
pushd "$toplevel" > /dev/null
for command in docker go jq; do
if ! command -v "$command" > /dev/null; then
echo "missing required command: $command"
exit 1
fi
done
if [ -n "$IMAGE_ARCHIVE" ]; then
if [ ! -f "$IMAGE_ARCHIVE" ]; then
echo "Docker image archive not found: $IMAGE_ARCHIVE"
exit 1
fi
load_output="$(docker load --input "$IMAGE_ARCHIVE" 2>&1)"
printf '%s\n' "$load_output"
COMPLEMENT_BASE_IMAGE="$(printf '%s\n' "$load_output" | sed -n 's/^Loaded image: //p; s/^Loaded image ID: //p' | tail -n1)"
if [ -z "$COMPLEMENT_BASE_IMAGE" ]; then
echo "could not determine the image loaded from: $IMAGE_ARCHIVE"
exit 1
fi
fi
if ! docker image inspect "$COMPLEMENT_BASE_IMAGE" > /dev/null 2>&1; then
echo "Complement base image not found: $COMPLEMENT_BASE_IMAGE"
echo "Build it with: cargo build -p conduwuit && docker build -t $COMPLEMENT_BASE_IMAGE -f docker/complement.Dockerfile ."
exit 1
fi
mkdir -p "$(dirname "$LOG_FILE")" "$(dirname "$RESULTS_FILE")"
LOG_TMP="$(mktemp "${LOG_FILE}.XXXXXX")"
RESULTS_TMP="$(mktemp "${RESULTS_FILE}.XXXXXX")"
trap 'rm -f "$LOG_TMP" "$RESULTS_TMP"' EXIT
echo ""
echo "running go test with:"
echo "\$COMPLEMENT_SRC: $COMPLEMENT_SRC"
COMPLEMENT_REVISION="$(git -C "$COMPLEMENT_SRC" rev-parse HEAD 2>/dev/null || echo unknown)"
echo "\$COMPLEMENT_REVISION: $COMPLEMENT_REVISION"
echo "\$COMPLEMENT_MSC: ${MSC:-all}"
echo "\$COMPLEMENT_BASE_IMAGE: $COMPLEMENT_BASE_IMAGE"
echo "\$RESULTS_FILE: $RESULTS_FILE"
echo "\$LOG_FILE: $LOG_FILE"
echo ""
# It's okay (likely, even) that `go test` exits nonzero
TEST_PACKAGES=(./tests/...)
if [ -n "$MSC" ]; then
test_files="$({
grep -rilE --include='*.go' "msc$MSC([^0-9]|$)" "$COMPLEMENT_SRC/tests" || true
find "$COMPLEMENT_SRC/tests" -type f -name '*.go' -print | while IFS= read -r file; do
if [[ "$(basename "$file")" =~ [Mm][Ss][Cc]$MSC([^0-9]|$) ]]; then
printf '%s\n' "$file"
fi
done
} | sort -u)"
if [ -z "$test_files" ]; then
echo "no Complement tests mention MSC$MSC"
exit 1
fi
TEST_PACKAGES=()
while IFS= read -r test_file; do
test_dir="$(dirname "$test_file")"
TEST_PACKAGES+=(".${test_dir#"$COMPLEMENT_SRC"}")
done <<< "$test_files"
fi
# `COMPLEMENT_ENABLE_DIRTY_RUNS=1` reuses the same complement container for faster complement, at the possible expense of test environment pollution
set +o pipefail
env \
-C "$COMPLEMENT_SRC" \
set +e
(cd "$COMPLEMENT_SRC" && \
COMPLEMENT_BASE_IMAGE="$COMPLEMENT_BASE_IMAGE" \
go test -tags="conduwuit_blacklist" -skip="$SKIPPED_COMPLEMENT_TESTS" -v -timeout 1h -json ./tests/... | tee "$LOG_FILE"
set -o pipefail
go test -tags="conduwuit_blacklist" -skip="$SKIPPED_COMPLEMENT_TESTS" -v -timeout 1h -json "${TEST_PACKAGES[@]}"
) | tee "$LOG_TMP"
test_status=${PIPESTATUS[0]}
set -e
# Post-process the results into an easy-to-compare format, sorted by Test name for reproducible results
jq -s -c 'sort_by(.Test)[]' < "$LOG_FILE" | jq -c '
jq -s -c 'sort_by(.Test)[]' < "$LOG_TMP" | jq -c '
select(
(.Action == "pass" or .Action == "fail" or .Action == "skip")
and .Test != null
) | {Action: .Action, Test: .Test}
' > "$RESULTS_FILE"
' > "$RESULTS_TMP"
mv "$LOG_TMP" "$LOG_FILE"
mv "$RESULTS_TMP" "$RESULTS_FILE"
trap - EXIT
echo ""
echo ""
@@ -65,3 +167,5 @@ echo "complement logs saved at $LOG_FILE"
echo "complement results saved at $RESULTS_FILE"
echo ""
echo ""
exit "$test_status"
-1
View File
@@ -1 +0,0 @@
The account deactivation page in the account management web UI now shows a message when OIDC is enabled instead of prompting users for a nonexistent account password.
-1
View File
@@ -1 +0,0 @@
Advertised MatrixRTC (MSC4143) support in `/_matrix/client/versions`. Contributed by @eleboucher.
@@ -1 +0,0 @@
Added the `provider_name` and `provider_icon` OIDC options, which show the identity provider's name and icon on the web login page. Contributed by @eleboucher.
@@ -1 +0,0 @@
Fixed the space hierarchy endpoints returning non-suggested `m.space.child` events in `children_state` when `suggested_only` was requested. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Fixed `!admin query pusher delete-all-user` reporting success without deleting any pushers. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Removing a device from the web UI will no longer show a "Back" link pointing to a 404. Contributed by @ginger.
-1
View File
@@ -1 +0,0 @@
Fixed simplified sliding sync omitting device list updates for rooms with only timeline changes. Contributed by @eleboucher.
-4
View File
@@ -1,4 +0,0 @@
Removed the ability to run a server with "challengeless registration" (i.e. the big scary long config option, with no captcha, email, or registration token requirements), without manually compiling
the server with non-default arguments. Contributed by @nex.
(This is part of a wider effort to reduce abuse in the Matrix network, of which servers that are easily automated cause a disproportionate amount of)
-1
View File
@@ -1 +0,0 @@
Re-added a cooldown when fetching events from remote servers that have previously failed to be pulled, preventing request spam.
-1
View File
@@ -1 +0,0 @@
One-time keys and fallback keys are now properly cleaned up when a device is deleted.
@@ -1 +0,0 @@
Fixed MSC4155 invite filtering being applied to outgoing invites, which prevented users from inviting anyone they had blocked or ignored invites from. Contributed by @eleboucher.
@@ -1 +0,0 @@
Fixed simplified Sliding Sync lists returning rooms out of activity order. Contributed by @eleboucher.
@@ -1 +0,0 @@
Fixed simplified Sliding Sync restarting when overlapping sync responses arrive out of order. Contributed by @eleboucher.
@@ -1 +0,0 @@
Fixed simplified Sliding Sync re-sending rooms in full after a list's window shrinks and grows again. Contributed by @eleboucher.
+81 -33
View File
@@ -891,48 +891,88 @@
#proxy = "none"
# Servers listed here will be used to gather public keys of other servers
# (notary trusted key servers).
# (trusted key notary servers), as well as serve as trusted servers for
# other operations like backfill and event fetching.
#
# Currently, continuwuity doesn't support inbound batched key requests, so
# Currently, continuwuity doesn't support inbound key requests, so
# this list should only contain other Synapse servers.
#
# example: ["matrix.org", "tchncs.de"]
# example: ["matrix.org", "starstruck.systems"]
#
# It is possible to restrict which signing keys trusted servers are
# allowed to sign responses with. Without configuring this, all responses
# from trusted servers will be implicitly trusted, which is fine for most
# users. Strict verification is only necessary if TLS interception is part
# of your threat model. Even without strict verification, signatures from
# the originating server must be valid, regardless of whether the trusted
# server's is valid or not.
#
# To enable strict validation, you need to pass a TOML table containing
# the trusted server name, and any public keys (not key IDs!) that you
# expect to sign responses. You can fetch the current public keys a remote
# server uses with `!admin federation get-signing-keys <server name>`.
# Only add public keys that aren't expired, and make sure to remove any
# that expire at a later date!
#
# Example:
# ```ignore
# trusted_servers = [{server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]}]
# ```
#
# You can also mix-and-match strict verification and lax verification
# trusted servers:
#
# ```ignore
# trusted_servers = [
# {server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]},
# "matrix.org"
# ]
# ```
#
# Trusted servers are queried in parallel, so order does not matter. You
# should not have more than five entries. You can set this value to an
# empty list (`[]`) to operate without trusted server assistance, but this
# is discouraged for performance and reliability reasons.
#
#trusted_servers = ["matrix.org"]
# Whether to query the servers listed in trusted_servers first or query
# the origin server first. For best security, querying the origin server
# first is advised to minimize the exposure to a compromised trusted
# server. For maximum federation/join performance this can be set to true,
# however other options exist to query trusted servers first under
# specific high-load circumstances and should be evaluated before setting
# this to true.
# Whether to prioritise trusted server lookups over origin server lookups.
#
# By default, both notaries and origin servers are queried in parallel,
# and handled on a first-come-first-serve basis, meaning the server always
# uses the fastest response(s).
#
# If you wish to prioritise handling responses from trusted servers
# *before* handling responses from origin servers, set this to true.
#
#query_trusted_key_servers_first = false
# Whether to query the servers listed in trusted_servers first
# specifically on room joins. This option limits the exposure to a
# compromised trusted server to room joins only. The join operation
# requires gathering keys from many origin servers which can cause
# significant delays. Therefor this defaults to true to mitigate
# unexpected delays out-of-the-box. The security-paranoid or those willing
# to tolerate delays are advised to set this to false. Note that setting
# query_trusted_key_servers_first to true causes this option to be
# ignored.
# Any old signing keys that were used to sign events using this server
# name.
#
#query_trusted_key_servers_first_on_join = true
# Only query trusted servers for keys and never the origin server. This is
# intended for clusters or custom deployments using their trusted_servers
# as forwarding-agents to cache and deduplicate requests. Notary servers
# do not act as forwarding-agents by default, therefor do not enable this
# unless you know exactly what you are doing.
# You do not need to populate this unless you previously used a different
# server software with the same server_name configured, and then have
# migrated to continuwuity.
#
#only_query_trusted_key_servers = false
# Maximum number of keys to request in each trusted server batch query.
# The expiry timestamp should be as exact as you can get it, as making it
# too old may inadvertently invalidate historical events sent by your
# server, and potentially make it impossible for you to use some rooms as
# a result. If your key was compromised, and you set the expiry timestamp
# too late, some forged events may continue to be allowed.
#
#trusted_server_batch_size = 1024
# If not configured, continuwuity will discover its own historical keys
# through trusted servers. For improved security, you can set this to an
# empty map ({}) to disable this behaviour, if you know you have no old
# signing keys.
#
# Example:
# {"ed25519:1"={expired_ts=1790506890859,key="d29vZndvb2Z3b29md29vZg"}}
#
# The map key should be the key ID, expired_ts should be unix
# milliseconds, and the actual key value should be the unpadded base64
# representation of the public key component of the expired signing key.
#
#old_verify_keys =
# Max log level for continuwuity. Allows debug, info, warn, or error.
#
@@ -1495,10 +1535,9 @@
#
# The authenticated equivalent endpoints are always enabled.
#
# Defaults to true for now, but this is highly subject to change, likely
# in the next release.
# Defaults to false, as unauthenticated media has been sunsetted.
#
#allow_legacy_media = true
#allow_legacy_media = false
# If set to true, prevents fetching new legacy remote media.
#
@@ -2174,6 +2213,15 @@
#
#connection_uri =
# Same as `connection_uri`, except loaded from a file. If `connection_uri`
# is defined, it is prioritized and `connection_uri_file` is ignored.
#
# The file will be read once, when Continuwuity starts. It is not
# currently reread when the server configuration is reloaded. If the file
# cannot be read, Continuwuity will fail to start.
#
#connection_uri_file =
# The outgoing address which will be used for sending emails.
#
# For a syntax guide, see https://datatracker.ietf.org/doc/html/rfc2822#section-3.4
+1 -1
View File
@@ -50,7 +50,7 @@ EOF
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.22.0
ENV BINSTALL_VERSION=1.23.0
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
+1 -1
View File
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.22.0
ENV BINSTALL_VERSION=1.23.0
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
+44 -20
View File
@@ -3,30 +3,54 @@
## Complement
Have a look at [Complement's repository][complement] for an explanation of what
it is.
it is. Continuwuity runs Complement manually; it is not part of the normal test
suite.
To test against Complement, with Nix (or [Lix](https://lix.systems) and
[direnv installed and set up][direnv] (run `direnv allow` after setting up the hook), you can:
### Run it locally
* Run `./bin/complement "$COMPLEMENT_SRC"` to build a Complement image, run
the tests, and output the logs and results to the specified paths. This will also output the OCI image
at `result`
* Run `nix build .#complement` from the root of the repository to just build a
Complement OCI image outputted to `result` (it's a `.tar.gz` file)
* Or download the latest Complement OCI image from the CI workflow artifacts
output from the commit/revision you want to test (e.g. from main)
[here][ci-workflows]
Install Git, Rust, Docker, Go, and `jq`. From this repository's root, build the
server image and run the suite:
If you want to use your own prebuilt OCI image (such as from our CI) without needing
Nix installed, put the image at `complement_oci_image.tar.gz` in the root of the repo
and run the script.
```bash
cargo build -p conduwuit
docker build -t continuwuity:complement -f docker/complement.Dockerfile .
./bin/complement
```
If you're on macOS and need to build an image, run `nix build .#linux-complement`.
The run can take up to an hour. The runner writes the full Go test stream to
`tests/test_results/complement/test_logs.jsonl` and a sorted pass/fail/skip
summary to `tests/test_results/complement/test_results.jsonl`. It exits nonzero
when Complement reports failing tests, after writing both files.
We have a Complement fork as some tests have needed to be fixed. This can be found
at [continuwuation/complement](https://forgejo.ellis.link/continuwuation/complement)
On first use, the runner downloads the pinned upstream Complement revision to
`target/complement`. Pass a checkout path or set `COMPLEMENT_SRC` to run a
different revision or the [Continuwuity fork][complement-fork].
To run test packages that mention an MSC, pass its number:
```bash
./bin/complement --msc 3391
```
This selects packages from Complement's source comments and file names, so it
can include tests shared with that MSC but does not claim a complete mapping.
To run a Docker image archive instead of building locally:
```bash
./bin/complement --image path/to/complement-image.tar.gz
```
`COMPLEMENT_ENABLE_DIRTY_RUNS=1` reuses Complement containers for faster local
runs, but can let state leak between tests. Do not use it when validating a
failure or updating the committed result summary.
The checked-in result summary is a baseline, not an assertion that every test
passes. Compare a manual run with it when working on a compliance fix:
```bash
git diff -- tests/test_results/complement/test_results.jsonl
```
[ci-workflows]:
https://forgejo.ellis.link/continuwuation/continuwuity/actions/?workflow=ci.yml&actor=0&status=1
[complement]: https://github.com/matrix-org/complement
[direnv]: https://direnv.net/docs/hook.html
[complement-fork]: https://forgejo.ellis.link/continuwuation/complement
+3
View File
@@ -15,6 +15,9 @@ hero:
- theme: alt
text: Star on GitHub
link: https://github.com/continuwuity/continuwuity
- theme: alt
text: Donate to us!
link: https://opencollective.com/continuwuity
image:
src: /assets/logo.svg
alt: continuwuity logo
@@ -6,10 +6,10 @@
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
},
{
"id": 19,
"id": 20,
"mention_room": true,
"date": "2026-08-24",
"message": "[Continuwuity 26.8.1](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.8.1) has just been released - this is a bug fix and feature release, with one small security patch. Please read the release notes for more information, before updating as soon as possible.\n\nAny questions? Ask in our [support room](https://matrix.to/#/#continuwuity:continuwuity.org)."
"date": "2026-09-16",
"message": "[Continuwuity 26.9.0](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.9.0) has just been released - this update features a bunch of bug fixes, and some bandwidth saving improvements for sliding sync.\n\nAny questions? Ask in our [support room](https://matrix.to/#/#continuwuity:continuwuity.org)!"
}
]
}
+1 -1
View File
@@ -64,7 +64,7 @@ Matrix federation is extremely heavy and sends wild amounts of DNS requests. Thi
Follow the [**DNS tuning guide**](./guides/dns) for details on setting it up.
### Intermittent federation failures to a specific server
### Intermittent federation failures to a specific server {#intermittent}
There may be circumstances where servers fail to connect to each other, probably due to a bad DNS cache. In such cases, issuing `!admin debug ping <SERVER_NAME>` would return some errors, and `!admin query resolver cache <SERVER_NAME>` would return a wrong destination endpoint.
Generated
+24 -24
View File
@@ -3,11 +3,11 @@
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1783840254,
"narHash": "sha256-XjyvZk0f3YiinVHmkGOotmLBAzvK+LwEJYj2QqJ5pn8=",
"lastModified": 1789329924,
"narHash": "sha256-mykGMFabQ7yP6G373M3VHkrac9PJPKJstrhQz2D/Rdc=",
"owner": "rustsec",
"repo": "advisory-db",
"rev": "6e3286f4efa8c142fb33e5ea4342c8db6693cf34",
"rev": "455fd4bac659b5f1fca3810661c2d8b3c25dad05",
"type": "github"
},
"original": {
@@ -18,11 +18,11 @@
},
"crane": {
"locked": {
"lastModified": 1783203018,
"narHash": "sha256-G6R9IT/xwFuu+CYBWDUAok6AdC4ERC4ZfPPFtEpxnZE=",
"lastModified": 1788465171,
"narHash": "sha256-Y1/TTVXjYXGF068IThQH9fPSZ0SIE74PABlUxnWTUH0=",
"owner": "ipetkov",
"repo": "crane",
"rev": "80db5bdc391be8a1794f6d8a2d56e3a84ebcede2",
"rev": "eb35abda9f232cc6610b1d1e3200d15c49b7ac54",
"type": "github"
},
"original": {
@@ -39,11 +39,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1783844668,
"narHash": "sha256-3MOpw4y3reoErRLvFBDz0t9aG6FWXUj7leKvUns5eQA=",
"lastModified": 1789298866,
"narHash": "sha256-6eaV5+MdWy1tAlN4HAFr64pTnYc9jiKGXBsu18cyVjE=",
"owner": "nix-community",
"repo": "fenix",
"rev": "4e49ef62eedaa5c149d62b63b3f53844e1cc45d7",
"rev": "1fc6f36a23fa16e3740987957266f6e4b915c3cd",
"type": "github"
},
"original": {
@@ -74,11 +74,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1782949081,
"narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=",
"lastModified": 1788450739,
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e",
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
"type": "github"
},
"original": {
@@ -89,11 +89,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1783776592,
"narHash": "sha256-UgCQzxeWI75XM8G+hPrPh+MKzEPjG3SpAj7dtqSbksA=",
"lastModified": 1789149629,
"narHash": "sha256-H6GwaZzZf+4npqv0tph94w9tZddSjFjmQrVsW0z78uk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e7a3ca8092b61ff85b6a45bf863ea2b2d6a661b3",
"rev": "eaad089433ca2bb662274377d33df3d0e51ef28b",
"type": "github"
},
"original": {
@@ -105,11 +105,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1782614948,
"narHash": "sha256-ePjCwr1sNm9NYUqywL7QfK3JnlS015msC+eBu2zKlp8=",
"lastModified": 1788057806,
"narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "db3f255737b94216eb71cce308e2912cf6bc2d7c",
"rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c",
"type": "github"
},
"original": {
@@ -132,11 +132,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1783779020,
"narHash": "sha256-vpm418WZa9l1KUl6HRs+Ga+SIfE+D2/sV4olwTlilYc=",
"lastModified": 1789128286,
"narHash": "sha256-KRxxgHiKIBp7R2n41IJuE5K4IUiLOpg47EEi3AxuSp8=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "5be5e89cf0145d73a85c805726821b4adfc3af48",
"rev": "6aeeb8cf02741e5da07a1615a05faa506cecb21a",
"type": "github"
},
"original": {
@@ -153,11 +153,11 @@
]
},
"locked": {
"lastModified": 1780220602,
"narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=",
"lastModified": 1786901030,
"narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "db947814a175b7ca6ded66e21383d938df01c227",
"rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa",
"type": "github"
},
"original": {
+3 -3
View File
@@ -16,7 +16,7 @@
pkgs.nodejs
pkgs.pkg-config
]
++ lib.optionals pkgs.stdenv.isLinux [
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.liburing
pkgs.rust-jemalloc-sys-unprefixed
];
@@ -27,13 +27,13 @@
[
pkgs.stdenv.cc.cc.lib
]
++ lib.optionals pkgs.stdenv.isLinux [
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.liburing
pkgs.jemalloc
]
);
}
// lib.optionalAttrs pkgs.stdenv.isLinux {
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" [
pkgs.liburing.dev
];
+173 -166
View File
@@ -125,13 +125,13 @@
}
},
"node_modules/@rsbuild/core": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.2.0.tgz",
"integrity": "sha512-UnBBfxWIDKVdLz2BUBq7hFBatwLclJ4moFhlDFg+pFBPPJ1g34MmCbGUC0c9Mo1DhPGdYJG69qMIldh5MvC74w==",
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.2.5.tgz",
"integrity": "sha512-nf34ri1iZduYhHUr5Vc79L7Eml+IlN0nFIaF/g3OW4WR/gShxuf5wVXS69/H8FTHJYN4SdYlNcefSZQluEMKgA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rspack/core": "2.2.0",
"@rspack/core": "~2.2.3",
"@swc/helpers": "^0.5.23"
},
"bin": {
@@ -169,32 +169,32 @@
}
},
"node_modules/@rspack/binding": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.2.0.tgz",
"integrity": "sha512-nxZzJqqB0EmEKp6qjzFNkBb/SgGt0k0DSENrLvAJgvVvrm3waVsubD0cfxtPlZY/rd5SzadzxWGEHRyFcds5nA==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.2.3.tgz",
"integrity": "sha512-532+T5N6yIdukChiL85H4NFN2vn9oi8wlLa1ByPNtpNYriE9s24fUhn0RiK7w/xACqnNpYmXCqLYCvjOzyCy+w==",
"dev": true,
"license": "MIT",
"optionalDependencies": {
"@rspack/binding-darwin-arm64": "2.2.0",
"@rspack/binding-darwin-x64": "2.2.0",
"@rspack/binding-linux-arm64-gnu": "2.2.0",
"@rspack/binding-linux-arm64-musl": "2.2.0",
"@rspack/binding-linux-ppc64-gnu": "2.2.0",
"@rspack/binding-linux-riscv64-gnu": "2.2.0",
"@rspack/binding-linux-riscv64-musl": "2.2.0",
"@rspack/binding-linux-s390x-gnu": "2.2.0",
"@rspack/binding-linux-x64-gnu": "2.2.0",
"@rspack/binding-linux-x64-musl": "2.2.0",
"@rspack/binding-wasm32-wasi": "2.2.0",
"@rspack/binding-win32-arm64-msvc": "2.2.0",
"@rspack/binding-win32-ia32-msvc": "2.2.0",
"@rspack/binding-win32-x64-msvc": "2.2.0"
"@rspack/binding-darwin-arm64": "2.2.3",
"@rspack/binding-darwin-x64": "2.2.3",
"@rspack/binding-linux-arm64-gnu": "2.2.3",
"@rspack/binding-linux-arm64-musl": "2.2.3",
"@rspack/binding-linux-ppc64-gnu": "2.2.3",
"@rspack/binding-linux-riscv64-gnu": "2.2.3",
"@rspack/binding-linux-riscv64-musl": "2.2.3",
"@rspack/binding-linux-s390x-gnu": "2.2.3",
"@rspack/binding-linux-x64-gnu": "2.2.3",
"@rspack/binding-linux-x64-musl": "2.2.3",
"@rspack/binding-wasm32-wasi": "2.2.3",
"@rspack/binding-win32-arm64-msvc": "2.2.3",
"@rspack/binding-win32-ia32-msvc": "2.2.3",
"@rspack/binding-win32-x64-msvc": "2.2.3"
}
},
"node_modules/@rspack/binding-darwin-arm64": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.2.0.tgz",
"integrity": "sha512-KAVVT7hp3NBjtc/RY2UtOjzzc8i+s4pIhW1p52UV+Aev6ywQCu3dXwkHTonpPvJO3hqLXc4zIMH5l4HbMqBm4g==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.2.3.tgz",
"integrity": "sha512-MGLx4lMTY6XEtJi55S+fk83+683GeUDuoqzjixbq6ehHdr/l6nGiHhgvMtV5DYt9sCytUDzyrCkcJ0AWqJxnTA==",
"cpu": [
"arm64"
],
@@ -206,9 +206,9 @@
]
},
"node_modules/@rspack/binding-darwin-x64": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.2.0.tgz",
"integrity": "sha512-rzyJCX99aFwl540trsVMNZOgK4+IFm2d5+YeP+RdNo9Uprxloz8vHz0J4dYtaq6MRiCAyM60dAwEa3wJMwqWAQ==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.2.3.tgz",
"integrity": "sha512-5B/c1YTYEz9m7TyqtGQgTmXMr9PoPewyqsyHB4N0AB7nxDhtgmki0GniP2Lqtx3LJzOvQMjwet+I2lmWxvxwCg==",
"cpu": [
"x64"
],
@@ -220,9 +220,9 @@
]
},
"node_modules/@rspack/binding-linux-arm64-gnu": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.2.0.tgz",
"integrity": "sha512-0t8QOiOMcBV7RvPSsTJ5DQ4QCK6FIyUZy77qbxnS6asGTOXPZZn7V5cL26IxEv/wuHdQ6tQOXheau1fi+gGyBQ==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.2.3.tgz",
"integrity": "sha512-sU+jPGD2xz3BxFvsdBQVGce538YHqrSKMB4ZSfKhj6RSKjeGzpJ1BVl8+IndiQsfTgaUxi7N+r5cs/ezGy1TVQ==",
"cpu": [
"arm64"
],
@@ -237,9 +237,9 @@
]
},
"node_modules/@rspack/binding-linux-arm64-musl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.2.0.tgz",
"integrity": "sha512-BAvCukqcuHxUdE294ITCohvhVkEklW8RbkKkR36Uo0WyIiMPGrnvPjARPn0/4Q4xMAz7lUmC60sZrvJHlAOKMw==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.2.3.tgz",
"integrity": "sha512-EQuADbqWbVgNAh5ep/u/B7Z/8UUkZjMLzHAOKZJklBpe4Y8mnhFNjieX0xc9NadR+drj9tqmEANxzTOkFtVPyQ==",
"cpu": [
"arm64"
],
@@ -254,9 +254,9 @@
]
},
"node_modules/@rspack/binding-linux-ppc64-gnu": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-2.2.0.tgz",
"integrity": "sha512-nCHqZLv/E8nm2ccGkb00F5DQtXxzGy3W3X73ArA+N0+zXJUnzRcSRSwr7AE8pVgP/FYfX4yMFgUXy0g0YxYGRA==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-2.2.3.tgz",
"integrity": "sha512-kyXROzr519a5juBII9ysuc5ZD2apEZ0DJqL5PPCAOVHjzMfThEIBwnX3gicNCmp+kY0CCIOl2LagwbtFaOzoiA==",
"cpu": [
"ppc64"
],
@@ -271,9 +271,9 @@
]
},
"node_modules/@rspack/binding-linux-riscv64-gnu": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-2.2.0.tgz",
"integrity": "sha512-CA3WEqKFDI6FAZTnCho2n9pmdPWZYAW/S8mqgxd0cx2Jix43at3VyLxhCC7ED5A9WBSFn/AdHaIbVtgoQHVhWA==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-2.2.3.tgz",
"integrity": "sha512-F3x6Nu0RUSoLtiaMse3hYQ3Nf5A2de6vTWWDXj14Ll6BpGWXGn+U/eXT/nB199fFnDEYf+CJEa7d6fzcYdwdjA==",
"cpu": [
"riscv64"
],
@@ -288,9 +288,9 @@
]
},
"node_modules/@rspack/binding-linux-riscv64-musl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-2.2.0.tgz",
"integrity": "sha512-kHB960oClkoPRPZ6sdkhRvqbdRIlbpIMYd/Tbxfmn3DWQahiCk1pkUFJbOtFq3EgESxZISV4THl442W2Y57HvQ==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-2.2.3.tgz",
"integrity": "sha512-O3HK7OnPvoBxZu4MX2j+t3gk4qiUsFYqj/29L3WgU1iQsdUSIN6PInW2JvbiLqyuzt09VltIEXTKayY8EysCpQ==",
"cpu": [
"riscv64"
],
@@ -305,9 +305,9 @@
]
},
"node_modules/@rspack/binding-linux-s390x-gnu": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-2.2.0.tgz",
"integrity": "sha512-lVBdiffVo1jq0P0jT36jNou2suLB4ueQI4aWUs+HM+h67YPBtVKWu/mo5Wh59+8nowgcZmYaFM5hdH69963I9w==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-2.2.3.tgz",
"integrity": "sha512-SIxfGdwBdAjwJ8pDlPTb8MPIZIv/i2lKHn4/ywuDpFOxlUA4Bo/OKqQOenHx2MFD2mN8jigBZQTF0KVe5YP1uQ==",
"cpu": [
"s390x"
],
@@ -322,9 +322,9 @@
]
},
"node_modules/@rspack/binding-linux-x64-gnu": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.2.0.tgz",
"integrity": "sha512-M49UaWspE0YJ3268DsquD8idEQTfjBDMvO/I8qccV/Z5T+Q98FJ+kIs5liUaTWb48OIbDEK+8ZKx5QzLbfVN6g==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.2.3.tgz",
"integrity": "sha512-IzQGcw09WYn/IzwB1SQpg7FQ211MBr+fJB2/WoRrPS6CNdtlkDHZaI8z2oq+2Oc5Su21jgX75VlWFajirUx5Dw==",
"cpu": [
"x64"
],
@@ -339,9 +339,9 @@
]
},
"node_modules/@rspack/binding-linux-x64-musl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.2.0.tgz",
"integrity": "sha512-YYbs0wmey+5blhEQDE4Dax3TwJtqfGwe2QBm3OLphlBHo/fcZVvimzKkMV0/pVrZTLy2z5ZAwNhGMY64bNr77w==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.2.3.tgz",
"integrity": "sha512-9OKSx2ickrR+PFal94XE6Hkj49AQ2HI3KuR9XeRkKOwSxjwrskV/Pn1wc2itDOHkm/QHP7k+MttsYb4FGuNIqw==",
"cpu": [
"x64"
],
@@ -356,9 +356,9 @@
]
},
"node_modules/@rspack/binding-wasm32-wasi": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.2.0.tgz",
"integrity": "sha512-rerLPTN/HD4EvLNWs3O2N+Eb37eGvLRIP3dXXc3n+UzTebOepAsahNn44vXeRBsE4m/pHkpDJjwgWTytgQ2gBw==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.2.3.tgz",
"integrity": "sha512-gici3jWJi0GDy9kbYh57LoA57H8A2EAD9cV2jFKp1YoJ2aX2U9lANh4L+xoKPTvVQYpRvleoA5jkAvyfeLQ5bw==",
"cpu": [
"wasm32"
],
@@ -372,9 +372,9 @@
}
},
"node_modules/@rspack/binding-win32-arm64-msvc": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.2.0.tgz",
"integrity": "sha512-JUAmnbOQYGTRyX28vls/MOMonZWcmcCi5YtEq6YMc8Xqh3Qx0HUwaLM/I1xr/N9BX3b8CV0dQDOpNuBc2ei+CA==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.2.3.tgz",
"integrity": "sha512-1MG66kcuqAGFs9ewiBc+/NJSTQr1jHrkZ2nCVMyhukl1o8embmFZa3BCibYgBYs5P7FRc6Sa+CDXcrfDZOLInQ==",
"cpu": [
"arm64"
],
@@ -386,9 +386,9 @@
]
},
"node_modules/@rspack/binding-win32-ia32-msvc": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.2.0.tgz",
"integrity": "sha512-wOmQRUaOG0eWH/fnfslA9yK9xKfaq9X+3Xa1TdTJnTqlo0ARJYs6A+Lzjbs7cxdY/o1f12Xe00BG3nQozReUOg==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.2.3.tgz",
"integrity": "sha512-CAigxxh9DYJmEwH9f6FRkSsmt0GhKVqKaFRVFFrF9WDL7gXP3hyE/h/cCeMdmlTzRt8Mht87AvnDX7PG3neMrA==",
"cpu": [
"ia32"
],
@@ -400,9 +400,9 @@
]
},
"node_modules/@rspack/binding-win32-x64-msvc": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.2.0.tgz",
"integrity": "sha512-v6/3bFr9+i7hRpgulL9b5qCvZL0VgR4vQGQNqOWezUzZmPUj9LYpvB0L9xZIVwDQ2ug/xBiA58bfg5IbESgoyw==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.2.3.tgz",
"integrity": "sha512-qa5Wc34a+Uux5foZ1Z+9fPQceVRbgTunaIulHezVF/ZxvqKO4DkAC7tFl53shB0YRVBAPg8R78MGd8cByfoxLQ==",
"cpu": [
"x64"
],
@@ -414,13 +414,13 @@
]
},
"node_modules/@rspack/core": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.2.0.tgz",
"integrity": "sha512-3W7oX0BAHbK4VlknH3lfyfRvupzxdZtyEa+DfKmdjzmIAcqYtHnFd0nLqp5dzitDPyDI1TIKkDhpB0AZJn0pVg==",
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.2.3.tgz",
"integrity": "sha512-VHejw+PDd5B5v6VduFyjLSTIFaHBMNGPMKw+Y0zjkMqjYhDD1hjLOBC5frRKjTWcfYdk+Q73auWPp9k/H9PfIQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rspack/binding": "2.2.0"
"@rspack/binding": "2.2.3"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
@@ -455,17 +455,17 @@
}
},
"node_modules/@rspress/core": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.21.tgz",
"integrity": "sha512-QxhVqhHhN4guA24MlvlsFTb96pE/X8gBd5RBfp4j1kn5tAu1nJ7A9itKcRAuEw0WYJHcsWtI+WUnd7JPioHtlw==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.22.tgz",
"integrity": "sha512-mS/+xJYxVSR72GAjTz8GIGcJwwb2NSbbduq1fQOSv7k73EJ2aa0Q/o14nnnI4DRmRSEmK0t81vkVGcKHWQzPcA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@mdx-js/mdx": "^3.1.1",
"@mdx-js/react": "^3.1.1",
"@rsbuild/core": "^2.1.13",
"@rsbuild/core": "^2.2.5",
"@rsbuild/plugin-react": "~2.1.0",
"@rspress/shared": "2.0.21",
"@rspress/shared": "2.0.22",
"@shikijs/rehype": "^4.2.0",
"@types/mdast": "^4.0.4",
"@types/react": "^19.2.18",
@@ -484,7 +484,7 @@
"react-dom": "^19.2.8",
"react-lazy-with-preload": "^2.2.1",
"react-render-to-markdown": "19.1.0",
"react-router-dom": "^7.18.2",
"react-router-dom": "^7.18.3",
"rehype-external-links": "^3.0.0",
"rehype-raw": "^7.0.0",
"remark-cjk-friendly": "^2.3.1",
@@ -508,9 +508,9 @@
}
},
"node_modules/@rspress/plugin-client-redirects": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.21.tgz",
"integrity": "sha512-21giX10Blom+dOJBJOxXZUS+pjez1Tb9iNA7L7km8uUkn5L45KfdQvYqbBHY6Nv6L46zaDdz0Mt97eAqBPgNoA==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.22.tgz",
"integrity": "sha512-pyOLIfxji1xbh//H0egdmhXVdO5hfp9dLXCTnZKcet9K3FJpre21/syuhRbRwWviMpcKtE73PZVcSaNVTYQYZw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -521,9 +521,9 @@
}
},
"node_modules/@rspress/plugin-sitemap": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.21.tgz",
"integrity": "sha512-PldjjLDFqtQZ3yPHHsWxmxGNlmoNH7nSx76ww7QkPzkO9rPrlr71sBLZR3MMc1s6cd5Csyd+gHjfIJiP7o77XQ==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.22.tgz",
"integrity": "sha512-2SNLW8Oh4osCyqnzea1WDVA9469Luwu0piNuh5HNjlzcgjguzynA3447WRFpqBL1Z/B7H5IB5SMcwYaMsgFhvQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -534,13 +534,13 @@
}
},
"node_modules/@rspress/shared": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.21.tgz",
"integrity": "sha512-siCWkv1a4n6y7JdVRII+fwCRZGZtG5KGFfKi2w/Tt33UnIgh4XGqozZ5F/K0iZ/QUwg0wi93SoVdOQm2Q+wf8w==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.22.tgz",
"integrity": "sha512-1UXwG6gAhWBw5vClv3wb2Oy8hPXYNgQwQ5zWXEG8auY5ZcMywvHCBi6pFJtYNOgXe5327lNgiOG0S1R8l0OLeg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rsbuild/core": "^2.1.13",
"@rsbuild/core": "^2.2.5",
"@shikijs/rehype": "^4.2.0",
"@types/react": "^19.2.18",
"mdast-util-mdx-jsx": "^3.2.0",
@@ -548,16 +548,16 @@
}
},
"node_modules/@shikijs/core": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.3.1.tgz",
"integrity": "sha512-ANMDxuaPsNMdDC1m4vfvhlDmJweMwkE5XitTwrq2rWHx5jM+dlm4MmHt2PP6t0uejfR77SuhrhJ0zEijIF/uhA==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.4.3.tgz",
"integrity": "sha512-QCR4q2ZO/ILJEuwiBMel4wdcTDb1JGwfjKTxPDF6x8ixOaluPrVqIn06C99AcRPhmYlBR56d/Fb+GN58GzExpg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/primitive": "4.3.1",
"@shikijs/types": "4.3.1",
"@shikijs/primitive": "4.4.3",
"@shikijs/types": "4.4.3",
"@shikijs/vscode-textmate": "^10.0.2",
"@types/hast": "^3.0.4",
"@types/hast": "^3.0.5",
"hast-util-to-html": "^9.0.5"
},
"engines": {
@@ -565,13 +565,13 @@
}
},
"node_modules/@shikijs/engine-javascript": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.3.1.tgz",
"integrity": "sha512-JBItcnPuYq7jVJdZo/vMj94r+szT7XEjHFX+mvFDGSEIbVAXAGyHAHzhbWzpGOwYidCZrErJLLgn2PVeiokHnQ==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.4.3.tgz",
"integrity": "sha512-FbOjFJp9VLdo1Wevs10BBtVxiTWwNLqZh5Gkhjgda/ioL15YOgeSl9n+6XMa3qRlPQzfhFNe641SrynFHYG0nQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/types": "4.3.1",
"@shikijs/types": "4.4.3",
"@shikijs/vscode-textmate": "^10.0.2",
"oniguruma-to-es": "^4.3.6"
},
@@ -580,13 +580,13 @@
}
},
"node_modules/@shikijs/engine-oniguruma": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.3.1.tgz",
"integrity": "sha512-OXyNMzg0pews+msMj4cHeqT4xiYKKvbnn6VbdAXxfoFl3SSx4fJTc8FadECuc5/H9p3BzhNAoAUXKwAu9rWYhg==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.4.3.tgz",
"integrity": "sha512-EcOQkxdxGQrc1Row/cC2c96/v1dbZqGnEVu1qTuT/MJmp6+cXCvQussowVmCv5Tqr3KuY3c7IbM6HTW3LJ1k9w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/types": "4.3.1",
"@shikijs/types": "4.4.3",
"@shikijs/vscode-textmate": "^10.0.2"
},
"engines": {
@@ -594,44 +594,44 @@
}
},
"node_modules/@shikijs/langs": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.3.1.tgz",
"integrity": "sha512-m0l9nsDqgBHvbZbk7A0/kXz/impK3uB/c6rAn6Gpg/uPtdZRQ+alsN/17MU5thb68XTj/4DxkZAotrM0GGSpDQ==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.4.3.tgz",
"integrity": "sha512-ePic0yfAJGOF83D5wBHK/00EjK65oahBYxFk5epgq33WRv7X9UuxLEV8PtR0szC0z8dl7INIpIodB99JRFlR+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/types": "4.3.1"
"@shikijs/types": "4.4.3"
},
"engines": {
"node": ">=20"
}
},
"node_modules/@shikijs/primitive": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.3.1.tgz",
"integrity": "sha512-CXQRQOYy1leqQ8ceTeJdmXv/bsUY++6QyLpXJ94LZAAYj5X2SKRdc5ipguv4NPyGVKItB2PPwUpRNe0Sjh5S1A==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.4.3.tgz",
"integrity": "sha512-m0wBeLDQDeIxRdUmrCPdQqfuUamDwRL5isCfYbguKD6NiaKpVbsv+3J81DyIKgNW5h4WAIIr8T4EkgQrBBxvaQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/types": "4.3.1",
"@shikijs/types": "4.4.3",
"@shikijs/vscode-textmate": "^10.0.2",
"@types/hast": "^3.0.4"
"@types/hast": "^3.0.5"
},
"engines": {
"node": ">=20"
}
},
"node_modules/@shikijs/rehype": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/rehype/-/rehype-4.3.1.tgz",
"integrity": "sha512-oshrlfUF3VPUJfnp5K1lLwsS/SRBKrIxONpdWebSKZXdBE3UsZnxgqpvRUA8UsofS7vmjFOCAHIT71ECbmOxTw==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/rehype/-/rehype-4.4.3.tgz",
"integrity": "sha512-vkG9jG1aRnrx05R31uAOKQHE8qpY7r1cBXE2sAZgFK2IaPnQHwaP4L1C6amQixmZ8thBsKwfbSsYxMDoo46UWQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/types": "4.3.1",
"@types/hast": "^3.0.4",
"@shikijs/types": "4.4.3",
"@types/hast": "^3.0.5",
"hast-util-to-string": "^3.0.1",
"shiki": "4.3.1",
"shiki": "4.4.3",
"unified": "^11.0.5",
"unist-util-visit": "^5.1.0"
},
@@ -640,27 +640,27 @@
}
},
"node_modules/@shikijs/themes": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.3.1.tgz",
"integrity": "sha512-dgpoJ4WqNi2yTmizQHBJ5zcX6j2lE6icN/0yt4l1kkf16jrY/pwPLoTb1ETsWMz0OBLf9ZNvwmxft+cH+N9qSA==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.4.3.tgz",
"integrity": "sha512-w8UHjeUnIR965KMWJHUPXOc2mNJUnK3vpVLYLvw5IYU2mnTTJ89E24OrJDBNiJDQ0qzb0tc4l7mrIXx5cFeIyw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/types": "4.3.1"
"@shikijs/types": "4.4.3"
},
"engines": {
"node": ">=20"
}
},
"node_modules/@shikijs/types": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.3.1.tgz",
"integrity": "sha512-CHFxE0jztBIZRHH6gxXE7DXUCFXjReEGxZ/j0rfSLGKZuwp2xBYycEP14875DSa9KLL/6700oxIq6oO6ef9K2g==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.4.3.tgz",
"integrity": "sha512-UEJxmRR++MAGR6hugn0vgVS2W/6lWAts84FFSrnlH9sP0LNol7E5+NQ792pH8liWUhyMyjhTgSUH3k7iD7tc5g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/vscode-textmate": "^10.0.2",
"@types/hast": "^3.0.4"
"@types/hast": "^3.0.5"
},
"engines": {
"node": ">=20"
@@ -684,9 +684,9 @@
}
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
"integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz",
"integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -756,9 +756,9 @@
"license": "MIT"
},
"node_modules/@types/react": {
"version": "19.2.18",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
"integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1113,9 +1113,9 @@
}
},
"node_modules/@ungap/structured-clone": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.3.tgz",
"integrity": "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.4.0.tgz",
"integrity": "sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==",
"dev": true,
"license": "ISC"
},
@@ -1136,9 +1136,9 @@
}
},
"node_modules/acorn": {
"version": "8.17.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz",
"integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==",
"version": "8.18.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
"dev": true,
"license": "MIT",
"bin": {
@@ -1470,9 +1470,9 @@
}
},
"node_modules/estree-util-scope": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz",
"integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.1.tgz",
"integrity": "sha512-B0np3dcdxqILX5e9nEi5/Fr4K7gL4oYFVPV1zRa2e9wRCbQoZZNWOZFYyoInvXUPJXBXjss+QXlWLJChDEHDkA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2525,9 +2525,9 @@
}
},
"node_modules/micromark-extension-gfm-table": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz",
"integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.2.tgz",
"integrity": "sha512-pRzm4kDTu0MjlmBkxmS9yYhw60nncfcEwu9NNdPFSQEFXS95ZKyIIyTSHu/o3ReBUrLKYEq+7YaXCRn/bPB4MA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3212,9 +3212,9 @@
}
},
"node_modules/react": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz",
"integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==",
"dev": true,
"license": "MIT",
"engines": {
@@ -3222,16 +3222,16 @@
}
},
"node_modules/react-dom": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
"integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
"version": "19.3.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz",
"integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"scheduler": "^0.27.0"
"scheduler": "^0.28.0"
},
"peerDependencies": {
"react": "^19.2.8"
"react": "^19.3.0"
}
},
"node_modules/react-lazy-with-preload": {
@@ -3257,6 +3257,13 @@
"react": "^19.2.0"
}
},
"node_modules/react-reconciler/node_modules/scheduler": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
"dev": true,
"license": "MIT"
},
"node_modules/react-refresh": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz",
@@ -3281,9 +3288,9 @@
}
},
"node_modules/react-router": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.2.tgz",
"integrity": "sha512-aUVMjFm3GAPTTZL7oYr5E7ETiqfQCHRLH+B+5afnICvf0r7kkK4eR6SMuwbSTJw/7t+12khT/Kahij49fqOCIg==",
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.3.tgz",
"integrity": "sha512-gyXgtdr5uACJ5b1Q4udzjVV+tb/rlHIMJKuJ0e89R4Kzgz47z/rgP0dIKxktqIEUhDHluGTPJJH/wRha7CyqsA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3304,13 +3311,13 @@
}
},
"node_modules/react-router-dom": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.2.tgz",
"integrity": "sha512-AIKJ/jgGlFb3EbfCXk5Gzshiwt+l3mqbCrNjmEWMMjqQxNJ3svBa6bgzFyCC2Sw3RA0VWF1kg3uQf2OFhxb8hw==",
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.3.tgz",
"integrity": "sha512-ytVbyBBM7vMfRCam25r0WMhSVSom909A8p+8m0/f1w853dz/xfFu6etAT2SEbVoSnI+ZoPRDqIsQXVT89gp7kg==",
"dev": true,
"license": "MIT",
"dependencies": {
"react-router": "7.18.2"
"react-router": "7.18.3"
},
"engines": {
"node": ">=20.0.0"
@@ -3601,9 +3608,9 @@
}
},
"node_modules/scheduler": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
"version": "0.28.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
"integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
"dev": true,
"license": "MIT"
},
@@ -3625,20 +3632,20 @@
"license": "MIT"
},
"node_modules/shiki": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-4.3.1.tgz",
"integrity": "sha512-oR+qDVi2OjX1tmDpyv+3KviX01KzO6Af+0NNnKnsp9491UEGz2YpxTuJboS/6VhYpTdqzmuJBuiTlrAWWJAssw==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-4.4.3.tgz",
"integrity": "sha512-Mb/GvXPHBAXdgGIcnfU5L3ldpn1XcxrGkPHwqgRx17/I2XRfqlFKk2vGkHWINn1kdXvzJZeuO3is6I9KLPFm0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@shikijs/core": "4.3.1",
"@shikijs/engine-javascript": "4.3.1",
"@shikijs/engine-oniguruma": "4.3.1",
"@shikijs/langs": "4.3.1",
"@shikijs/themes": "4.3.1",
"@shikijs/types": "4.3.1",
"@shikijs/core": "4.4.3",
"@shikijs/engine-javascript": "4.4.3",
"@shikijs/engine-oniguruma": "4.4.3",
"@shikijs/langs": "4.4.3",
"@shikijs/themes": "4.4.3",
"@shikijs/types": "4.4.3",
"@shikijs/vscode-textmate": "^10.0.2",
"@types/hast": "^3.0.4"
"@types/hast": "^3.0.5"
},
"engines": {
"node": ">=20"
+11 -7
View File
@@ -52,6 +52,13 @@ export default defineConfig({
mode: 'link',
content: 'https://github.com/continuwuity/continuwuity',
},
{
icon: {
svg: `<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Open Collective</title><path fill="currentColor" d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12c2.54 0 4.894-.79 6.834-2.135l-3.107-3.109a7.715 7.715 0 1 1 0-13.512l3.107-3.109A11.943 11.943 0 0 0 12 0zm9.865 5.166l-3.109 3.107A7.67 7.67 0 0 1 19.715 12a7.682 7.682 0 0 1-.959 3.727l3.109 3.107A11.943 11.943 0 0 0 24 12c0-2.54-.79-4.894-2.135-6.834z"/></svg>`
},
mode: 'link',
content: 'https://opencollective.com/continuwuity',
},
],
lastUpdated: true,
enableContentAnimation: true,
@@ -65,16 +72,13 @@ export default defineConfig({
}),
pluginClientRedirects({
redirects: [{
from: '/configuration/examples',
from: '^/config_reference$',
to: '/reference/config'
}, {
from: '/admin_reference',
from: '^/admin_reference$',
to: '/reference/admin'
}, {
from: '/server_reference',
to: '/reference/server'
}, {
from: '/community$',
from: '^/community$',
to: '/community/guidelines'
}, {
from: "^/turn$",
@@ -83,7 +87,7 @@ export default defineConfig({
from: "^/livekit$",
to: "/calls/livekit",
}, {
from: "^/dns",
from: "^/dns$",
to: "/guides/dns",
}, {
from: "^/source(|_code)$",
-1
View File
@@ -85,7 +85,6 @@ dtor.workspace = true
futures.workspace = true
lettre.workspace = true
log.workspace = true
assign.workspace = true
ruma.workspace = true
serde_json.workspace = true
serde-saphyr.workspace = true
+5 -59
View File
@@ -694,11 +694,11 @@ impl crate::Context<'_> {
| Ok(value) => match self
.services
.server_keys
.verify_json(&value, &room_version_rules)
.verify_event_json(&value, &room_version_rules)
.await
{
| Err(e) => return Err!("Signature verification failed: {e}"),
| Ok(()) => write!(self, "Signature correct"),
| Ok(_) => write!(self, "Signature correct"),
},
}
.await
@@ -714,7 +714,7 @@ impl crate::Context<'_> {
let msg = match self
.services
.server_keys
.verify_event(&event, &room_version_rules)
.verify_event_json(&event, &room_version_rules)
.await
{
| Err(e) => return Err(e),
@@ -849,7 +849,7 @@ impl crate::Context<'_> {
for result in remote_state_response.pdus.iter().map(|pdu| {
self.services
.server_keys
.validate_and_add_event_id(pdu, &room_version_rules)
.verify_event_json_no_fetch_add_event_id(pdu, &room_version_rules)
}) {
let Ok((event_id, value)) = result.await else {
continue;
@@ -887,7 +887,7 @@ impl crate::Context<'_> {
for result in remote_state_response.auth_chain.iter().map(|pdu| {
self.services
.server_keys
.validate_and_add_event_id(pdu, &room_version_rules)
.verify_event_json_no_fetch_add_event_id(pdu, &room_version_rules)
}) {
let Ok((event_id, value)) = result.await else {
continue;
@@ -943,60 +943,6 @@ impl crate::Context<'_> {
.await
}
pub(super) async fn get_signing_keys(
&self,
server_name: Option<OwnedServerName>,
notary: Option<OwnedServerName>,
query: bool,
) -> Result {
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone());
if let Some(notary) = notary {
let signing_keys = self
.services
.server_keys
.notary_request(&notary, &server_name)
.await?;
let out = format!("```rs\n{signing_keys:#?}\n```");
return self.write_str(&out).await;
}
let signing_keys = if query {
self.services
.server_keys
.server_request(&server_name)
.await?
} else {
self.services
.server_keys
.signing_keys_for(&server_name)
.await?
};
let out = format!("```rs\n{signing_keys:#?}\n```");
self.write_str(&out).await
}
pub(super) async fn get_verify_keys(&self, server_name: Option<OwnedServerName>) -> Result {
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone());
let keys = self
.services
.server_keys
.verify_keys_for(&server_name)
.await;
let mut out = String::new();
writeln!(out, "| Key ID | Public Key |")?;
writeln!(out, "| --- | --- |")?;
for (key_id, key) in keys {
writeln!(out, "| {key_id} | {key:?} |")?;
}
self.write_str(&out).await
}
pub(super) async fn resolve_true_destination(
&self,
server_name: OwnedServerName,
-16
View File
@@ -103,22 +103,6 @@ pub enum DebugCommand {
event_id: OwnedEventId,
},
/// Get and display signing keys from local cache or remote server.
GetSigningKeys {
server_name: Option<OwnedServerName>,
#[arg(long)]
notary: Option<OwnedServerName>,
#[arg(short, long)]
query: bool,
},
/// Get and display signing keys from local cache or remote server.
GetVerifyKeys {
server_name: Option<OwnedServerName>,
},
/// Sends a federation request to the remote server's
/// `/_matrix/federation/v1/version` endpoint and measures the latency it
/// took for the server to respond
+27 -1
View File
@@ -2,7 +2,7 @@ use std::fmt::Write;
use conduwuit::{Err, Result, utils::response::LimitReadExt};
use futures::StreamExt;
use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId};
use ruma::{MilliSecondsSinceUnixEpoch, OwnedRoomId, OwnedServerName, OwnedUserId};
use crate::get_room_info;
@@ -131,4 +131,30 @@ impl crate::Context<'_> {
self.write_str(&format!("Rooms {user_id} shares with us ({num}):\n```\n{body}\n```"))
.await
}
pub(super) async fn get_signing_keys(&self, server_name: OwnedServerName) -> Result {
let response = self
.services
.server_keys
.origin_request(server_name, MilliSecondsSinceUnixEpoch::now())
.await?;
self.write_str("| Key ID | Public Key | Expired (unix milliseconds) |\n")
.await?;
self.write_str("| ------ | ---------- | --------------------------- |\n")
.await?;
for (key_id, key) in &response.verify_keys {
self.write_str(&format!("| {key_id} | {} | |\n", key.key))
.await?;
}
for (key_id, old_key) in &response.old_verify_keys {
self.write_str(&format!(
"| {key_id} | {} | {:0<13} |\n",
old_key.key,
old_key.expired_ts.get().to_string()
))
.await?;
}
Ok(())
}
}
+5
View File
@@ -39,4 +39,9 @@ pub enum FederationCommand {
RemoteUserInRooms {
user_id: OwnedUserId,
},
/// Queries the remote server for their current signing keys.
GetSigningKeys {
server_name: OwnedServerName,
},
}
-1
View File
@@ -32,7 +32,6 @@ use crate::{admin, admin::AdminCommand, context::Context};
#[must_use]
pub(super) fn complete(line: &str) -> String { complete_command(AdminCommand::command(), line) }
#[must_use]
pub(super) fn dispatch(services: Arc<Services>, command: CommandInput) -> ProcessorFuture {
Box::pin(handle_command(services, command))
}
-14
View File
@@ -1,6 +1,5 @@
use clap::Subcommand;
use conduwuit::Result;
use ruma::OwnedServerName;
use crate::Context;
@@ -12,12 +11,6 @@ pub enum GlobalsCommand {
CurrentCount,
LastCheckForAnnouncementsId,
/// This returns an empty `Ok(BTreeMap<..>)` when there are no keys found
/// for the server.
SigningKeysFor {
origin: OwnedServerName,
},
}
/// All the getters and iterators from src/database/key_value/globals.rs
@@ -47,13 +40,6 @@ pub(super) async fn process(subcommand: GlobalsCommand, context: &Context<'_>) -
.await;
let query_time = timer.elapsed();
write!(context, "Query completed in {query_time:?}:\n\n```rs\n{results:#?}\n```")
},
| GlobalsCommand::SigningKeysFor { origin } => {
let timer = tokio::time::Instant::now();
let results = services.server_keys.verify_keys_for(&origin).await;
let query_time = timer.elapsed();
write!(context, "Query completed in {query_time:?}:\n\n```rs\n{results:#?}\n```")
},
}
+1 -1
View File
@@ -204,7 +204,7 @@ impl crate::Context<'_> {
},
};
room_ids.push(room_id.clone());
room_ids.push(room_id);
}
if room_alias_or_id.is_room_alias_id() {
+5 -5
View File
@@ -206,13 +206,13 @@ impl crate::Context<'_> {
);
},
}
self.write_str(&format!(
"Successfully reset the password for user {user_id}: `{new_password}`"
))
.await?;
}
self.write_str(&format!(
"Successfully reset the password for user {user_id}: `{new_password}`"
))
.await?;
if logout {
self.services
.users
-5
View File
@@ -63,8 +63,6 @@ zstd_compression = [
]
[dependencies]
async-trait.workspace = true
axum-extra.workspace = true
axum.workspace = true
base64.workspace = true
bytes.workspace = true
@@ -80,16 +78,13 @@ hmac.workspace = true
http.workspace = true
http-body-util.workspace = true
hyper.workspace = true
ipaddress.workspace = true
itertools.workspace = true
lettre.workspace = true
log.workspace = true
rand.workspace = true
reqwest.workspace = true
assign.workspace = true
ruma.workspace = true
ruminuwuity.workspace = true
serde_html_form.workspace = true
serde_json.workspace = true
serde.workspace = true
sha1.workspace = true
+6
View File
@@ -13,6 +13,7 @@ use ruma::{
},
assign,
};
use serde_json::json;
use crate::Ruma;
@@ -55,5 +56,10 @@ pub(crate) async fn get_capabilities_route(
assign!(ProfileFieldsCapability::new(true), { disallowed: Some(services.oidc.restricted_profile_fields()) }),
);
capabilities.set(
"org.matrix.msc4174.webpush",
json!({ "enabled": true, "vapid": services.pusher.webpush_vapid_public_key() }),
)?;
Ok(get_capabilities::v3::Response::new(capabilities))
}
+13 -2
View File
@@ -1,6 +1,7 @@
use axum::extract::State;
use conduwuit::{
Err, Event, Result, at, debug_warn, err, ref_at,
result::LogErr,
utils::{
IterStream,
future::TryExtExt,
@@ -98,7 +99,12 @@ pub(crate) async fn get_context_route(
.pdus_rev(room_id, Some(base_count))
.ignore_err()
.then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
@@ -121,7 +127,12 @@ pub(crate) async fn get_context_route(
.pdus(room_id, Some(base_count))
.ignore_err()
.then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
+18 -3
View File
@@ -523,7 +523,22 @@ where
for (server, response) in futures {
match response {
| Ok(response) => {
for (user, master_key) in response.master_keys {
let is_wanted = |user_id: &UserId| {
user_id.server_name() == server && device_keys_input.contains_key(user_id)
};
let filtered_master_keys = response
.master_keys
.into_iter()
.filter(|(user_id, _)| is_wanted(user_id));
let filtered_self_signing_keys = response
.self_signing_keys
.into_iter()
.filter(|(user_id, _)| is_wanted(user_id));
let filtered_device_keys = response
.device_keys
.into_iter()
.filter(|(user_id, _)| is_wanted(user_id));
for (user, master_key) in filtered_master_keys {
let (master_key_id, mut master_key) = parse_master_key(&user, &master_key)?;
if let Ok(our_master_key) = services
@@ -549,8 +564,8 @@ where
}
}
self_signing_keys.extend(response.self_signing_keys);
device_keys.extend(response.device_keys);
self_signing_keys.extend(filtered_self_signing_keys);
device_keys.extend(filtered_device_keys);
},
| Err(e) => {
failures.insert(server.to_string(), json!({ "error": e.to_string() }));
+8 -2
View File
@@ -140,7 +140,12 @@ pub(crate) async fn get_message_events_route(
.wide_filter_map(|item| visibility_filter(&services, item, sender_user))
.take(limit)
.then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
@@ -375,5 +380,6 @@ pub(crate) async fn is_ignored_invite(
services
.users
.invite_filter_level(&sender_user, recipient_user)
.await == FilterLevel::Ignore
.await
== FilterLevel::Ignore
}
+7 -7
View File
@@ -1,7 +1,7 @@
use axum::extract::State;
use conduwuit::{Err, Result};
use futures::StreamExt;
use ruma::{OwnedRoomId, api::client::membership::mutual_rooms};
use ruma::{OwnedRoomId, api::client::membership::get_mutual_rooms};
use crate::Ruma;
@@ -13,8 +13,8 @@ use crate::Ruma;
#[tracing::instrument(skip_all, name = "mutual_rooms", level = "info")]
pub(crate) async fn get_mutual_rooms_unstable_route(
State(services): State<crate::State>,
body: Ruma<mutual_rooms::unstable::Request>,
) -> Result<mutual_rooms::unstable::Response> {
body: Ruma<get_mutual_rooms::unstable::Request>,
) -> Result<get_mutual_rooms::unstable::Response> {
let sender_user = body.identity.expect_sender_user()?;
if sender_user == body.user_id {
@@ -28,7 +28,7 @@ pub(crate) async fn get_mutual_rooms_unstable_route(
.collect()
.await;
Ok(mutual_rooms::unstable::Response::new(mutual_rooms))
Ok(get_mutual_rooms::unstable::Response::new(mutual_rooms))
}
/// # `GET /_matrix/client/v1/mutual_rooms`
@@ -37,8 +37,8 @@ pub(crate) async fn get_mutual_rooms_unstable_route(
#[tracing::instrument(skip_all, name = "mutual_rooms", level = "info")]
pub(crate) async fn get_mutual_rooms_route(
State(services): State<crate::State>,
body: Ruma<mutual_rooms::v1::Request>,
) -> Result<mutual_rooms::v1::Response> {
body: Ruma<get_mutual_rooms::v1::Request>,
) -> Result<get_mutual_rooms::v1::Response> {
let sender_user = body.identity.expect_sender_user()?;
if sender_user == body.user_id {
@@ -52,7 +52,7 @@ pub(crate) async fn get_mutual_rooms_route(
.collect()
.await;
Ok(mutual_rooms::v1::Response::new(
Ok(get_mutual_rooms::v1::Response::new(
mutual_rooms
.len()
.try_into()
+77 -8
View File
@@ -1,13 +1,16 @@
use std::sync::LazyLock;
use axum::extract::State;
use conduwuit::{Err, Error, Result, err};
use conduwuit_service::Services;
use conduwuit::{Err, Error, Result, err, utils::IterStream};
use conduwuit_service::{Services, pusher::ActivationOutcome};
use futures::StreamExt;
use ruma::{
CanonicalJsonObject, CanonicalJsonValue,
api::{
client::push::{
delete_pushrule, get_pushers, get_pushrule, get_pushrule_actions,
get_pushrule_enabled, get_pushrules_all, get_pushrules_global_scope, set_pusher,
set_pushrule, set_pushrule_actions, set_pushrule_enabled,
delete_pushrule, get_pushrule, get_pushrule_actions, get_pushrule_enabled,
get_pushrules_all, get_pushrules_global_scope, set_pushrule, set_pushrule_actions,
set_pushrule_enabled,
},
error::ErrorKind,
},
@@ -20,6 +23,12 @@ use ruma::{
RemovePushRuleError, Ruleset,
},
};
use ruminuwuity::pushers::{
PusherKind,
ack::unstable as pushers_ack,
get_pushers::{self, v3::PusherWithActivation},
set_pusher,
};
use crate::Ruma;
@@ -460,7 +469,29 @@ pub(crate) async fn get_pushers_route(
) -> Result<get_pushers::v3::Response> {
let sender_user = body.identity.expect_sender_user()?;
Ok(get_pushers::v3::Response::new(services.pusher.get_pushers(sender_user).await))
let pushers = services
.pusher
.get_pushers(sender_user)
.await
.into_iter()
.stream()
.then(async |pusher| {
let activated = match pusher.kind {
| PusherKind::WebPush(_) => Some(
services
.pusher
.is_webpush_activated(sender_user, pusher.ids.pushkey.as_str())
.await,
),
| _ => None,
};
PusherWithActivation { pusher, activated }
})
.collect()
.await;
Ok(get_pushers::v3::Response::new(pushers))
}
/// # `POST /_matrix/client/r0/pushers/set`
@@ -475,12 +506,50 @@ pub(crate) async fn set_pushers_route(
let sender_user = body.identity.expect_sender_user()?;
let sender_device = body.identity.expect_sender_device()?;
services
let needs_activation = services
.pusher
.set_pusher(sender_user, sender_device, &body.action)
.await?;
Ok(set_pusher::v3::Response::new())
Ok(set_pusher::v3::Response::new(needs_activation))
}
pub(crate) async fn pushers_ack_route(
State(services): State<crate::State>,
body: Ruma<pushers_ack::Request>,
) -> Result<pushers_ack::Response> {
let sender_user = body.identity.expect_sender_user()?;
match services
.pusher
.activate_webpush_pusher(sender_user, &body.app_id, &body.ack_token)
.await?
{
| ActivationOutcome::Activated => Ok(pushers_ack::Response::new()),
| ActivationOutcome::NoSuchPusher => {
Err!(Request(NotFound("No pusher with this app ID exists.")))
},
| ActivationOutcome::UnknownToken => Err(Error::Request(
UNKNOWN_ACTIVATION_TOKEN.clone(),
"Unknown activation token.".into(),
http::StatusCode::BAD_REQUEST,
)),
| ActivationOutcome::Expired => Err(Error::Request(
EXPIRED_ACTIVATION_TOKEN.clone(),
"Activation token has expired.".into(),
http::StatusCode::BAD_REQUEST,
)),
}
}
static EXPIRED_ACTIVATION_TOKEN: LazyLock<ErrorKind> =
LazyLock::new(|| custom_error_kind("ORG.MATRIX.MSC4174_EXPIRED_ACTIVATION_TOKEN"));
static UNKNOWN_ACTIVATION_TOKEN: LazyLock<ErrorKind> =
LazyLock::new(|| custom_error_kind("ORG.MATRIX.MSC4174_UNKNOWN_ACTIVATION_TOKEN"));
fn custom_error_kind(errcode: &str) -> ErrorKind {
serde_json::from_value(serde_json::json!({ "errcode": errcode }))
.expect("errcode deserializes into an ErrorKind")
}
/// user somehow has bad push rules, these must always exist per spec.
+35 -10
View File
@@ -1,6 +1,5 @@
use axum::extract::State;
use conduwuit::{Err, Event, Result, debug_warn, err};
use futures::{FutureExt, TryFutureExt, future::try_join};
use ruma::api::client::room::get_room_event;
use crate::{Ruma, client::is_ignored_pdu};
@@ -16,19 +15,40 @@ pub(crate) async fn get_room_event_route(
let event_id = &body.event_id;
let room_id = &body.room_id;
let event = services
.rooms
.timeline
.get_remote_pdu(room_id, event_id)
.map_err(|_| err!(Request(NotFound("Event {} not found.", event_id))));
let mut event = match services.rooms.timeline.get_pdu(event_id).await {
| Ok(event) => event,
| Err(e) if e.is_not_found() => {
// Only fetch over federation for users who could see the event.
let (joined, world_readable) = tokio::join!(
services.rooms.state_cache.is_joined(sender_user, room_id),
services.rooms.state_accessor.is_world_readable(room_id)
);
if !joined && !world_readable {
return Err!(Request(NotFound("Event {event_id} not found.")));
}
services
.rooms
.timeline
.get_remote_pdu(room_id, event_id)
.await
.map_err(|_| err!(Request(NotFound("Event {event_id} not found."))))?
},
| Err(e) => return Err(e),
};
if !event.room_id_or_hash().eq(room_id) {
// Return not found instead of invalid param to avoid revealing the
// existence of events the user might not be allowed to know about.
return Err!(Request(NotFound("Event {event_id} not found.")));
}
// NOTE: checked after fetching, as visibility of an unknown event cannot
// be determined (user_can_see_event returns true for those).
let visible = services
.rooms
.state_accessor
.user_can_see_event(sender_user, room_id, event_id)
.map(Ok);
let (mut event, visible) = try_join(event, visible).await?;
.await;
if !visible || is_ignored_pdu(services, &event, sender_user).await? {
return Err!(Request(Forbidden("You don't have permission to view this event.")));
@@ -43,7 +63,12 @@ pub(crate) async fn get_room_event_route(
debug_warn!("Failed to add bundled aggregations to event: {e}");
}
event.set_unsigned(Some(body.identity.expect_sender_user()?));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&event, Some(sender_user))
.await;
event.set_unsigned(Some(ctx))?;
Ok(get_room_event::v3::Response::new(event.into_format()))
}
+7 -1
View File
@@ -1,6 +1,7 @@
use axum::extract::State;
use conduwuit::{
Err, Event, Result, at, debug_warn,
result::LogErr,
utils::{BoolExt, stream::TryTools},
};
use futures::{FutureExt, TryStreamExt, future::try_join4};
@@ -53,7 +54,12 @@ pub(crate) async fn room_initial_sync_route(
.pdus_rev(room_id, None)
.try_take(limit)
.and_then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
+20 -8
View File
@@ -6,8 +6,10 @@ use std::collections::VecDeque;
use conduwuit::{
Event, PduCount, Result, debug_warn, err,
matrix::pdu::PduEvent,
ref_at, trace,
utils::stream::{BroadbandExt, ReadyExt, TryIgnore},
ref_at,
result::LogErr,
trace,
utils::stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt},
};
use conduwuit_service::Services;
use futures::StreamExt;
@@ -83,9 +85,14 @@ async fn load_timeline(
.pdus_rev(room_id, ending_count.map(|count| count.saturating_add(1)))
.ignore_err()
.ready_take_while(move |&(pducount, _)| pducount > starting_count)
.map(move |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
pdu
.wide_filter_map(async |mut pdu| {
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
Some(pdu)
})
.then(async move |mut pdu| {
if let Err(e) = services
@@ -108,9 +115,14 @@ async fn load_timeline(
.timeline
.pdus_rev(room_id, ending_count.map(|count| count.saturating_add(1)))
.ignore_err()
.map(move |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
pdu
.wide_filter_map(async |mut pdu| {
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
Some(pdu)
})
.then(async move |mut pdu| {
if let Err(e) = services
+7 -1
View File
@@ -6,6 +6,7 @@ use conduwuit::{
Event,
pdu::{PduCount, PduEvent, sticky},
},
result::LogErr,
trace,
utils::{
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
@@ -322,7 +323,12 @@ async fn build_sticky_events(
continue;
}
pdu.set_unsigned(Some(syncing_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu, Some(sync_context.syncing_user))
.await;
pdu.set_unsigned(Some(ctx)).log_err().ok();
events.push(Event::into_format(pdu));
}
+27 -13
View File
@@ -11,6 +11,7 @@ use conduwuit::{
Event, TypeStateKey,
pdu::{PduCount, PduEvent, sticky},
},
result::LogErr,
trace,
utils::{
BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt,
@@ -725,7 +726,8 @@ async fn stripped_state_event(
.get_field::<StateEventType>("type")
.ok()
.flatten()
.as_ref() == Some(event_type)
.as_ref()
== Some(event_type)
})
}
@@ -855,15 +857,21 @@ where
};
if body.extensions.account_data.enabled == Some(true) {
response.extensions.account_data.rooms.insert(
room_id.to_owned(),
services
let room_account_data: Vec<_> = services
.account_data
.changes_since(Some(room_id), sender_user, Some(*roomsince), Some(next_batch))
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Room))
.collect()
.await;
// An empty entry makes clients treat the room as updated.
if !room_account_data.is_empty() {
response
.extensions
.account_data
.changes_since(Some(room_id), sender_user, Some(*roomsince), Some(next_batch))
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Room))
.collect()
.await,
);
.rooms
.insert(room_id.to_owned(), room_account_data);
}
}
let last_privateread_update = services
@@ -1182,12 +1190,12 @@ async fn collect_sticky_events(
// MSC4480 lets us ignore the limit for a newly visible room's backlog
for (room_id, pdu) in backlog {
push_sticky_event(&mut response, sender_user, room_id, pdu);
push_sticky_event(services, &mut response, sender_user, room_id, pdu).await;
}
let mut next_batch = None;
for (count, room_id, pdu) in stream.into_iter().take(limit) {
push_sticky_event(&mut response, sender_user, room_id, pdu);
push_sticky_event(services, &mut response, sender_user, room_id, pdu).await;
next_batch = Some(count);
}
@@ -1198,13 +1206,19 @@ async fn collect_sticky_events(
Ok(response)
}
fn push_sticky_event(
async fn push_sticky_event(
services: &Services,
response: &mut sync_events::v5::response::StickyEvents,
sender_user: &UserId,
room_id: OwnedRoomId,
mut pdu: PduEvent,
) {
pdu.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu, Some(sender_user))
.await;
pdu.set_unsigned(Some(ctx)).log_err().ok();
response
.rooms
.entry(room_id)
+1 -4
View File
@@ -171,6 +171,7 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&client::get_key_changes_route)
.ruma_route(&client::get_pushers_route)
.ruma_route(&client::set_pushers_route)
.ruma_route(&client::pushers_ack_route)
.ruma_route(&client::upgrade_room_route)
.ruma_route(&client::get_threads_route)
.ruma_route(&client::get_relating_events_with_rel_type_and_event_type_route)
@@ -199,10 +200,6 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
router = router
.ruma_route(&server::get_server_version_route)
.route("/_matrix/key/v2/server", get(server::get_server_keys_route))
.route(
"/_matrix/key/v2/server/{key_id}",
get(server::get_server_keys_deprecated_route),
)
.ruma_route(&server::get_public_rooms_route)
.ruma_route(&server::get_public_rooms_filtered_route)
.ruma_route(&server::send_transaction_message_route)
+19 -8
View File
@@ -1,9 +1,13 @@
use std::any::{Any, TypeId};
use conduwuit::{Err, Error, Result, err, utils::IterStream};
use conduwuit::{
Err, Error, Result, err,
utils::{IterStream, millis_since_unix_epoch},
};
use http::StatusCode;
use ruma::{
DeviceId, OwnedDeviceId, OwnedServerName, OwnedUserId, UserId,
DeviceId, MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedServerName, OwnedUserId, UInt,
UserId,
api::{
IncomingRequest,
auth_scheme::{
@@ -127,18 +131,24 @@ impl CheckAuth for ServerSignatures {
return Err!(Request(Unauthorized("Destination mismatch.")));
}
let min_valid_ts =
MilliSecondsSinceUnixEpoch(UInt::new_saturating(millis_since_unix_epoch()));
let key = services
.server_keys
.get_verify_key(&output.origin, &output.key)
.get_single_verify_key(&output.origin, &output.key, min_valid_ts)
.await
.map_err(|e| {
err!(Request(Unauthorized(warn!("Failed to fetch signing keys: {e}"))))
.ok_or_else(|| {
err!(Request(Unauthorized(debug_warn!(
origin=%output.origin,
"Unable to acquire your signing key (ID: {})",
output.key
))))
})?;
let keys: PubKeys = [(output.key.to_string(), key.key)].into();
let keys: PubKeyMap = [(output.origin.as_str().into(), keys)].into();
match output.verify_request(request, destination, &keys) {
match output.verify_http_request(request, destination, &keys) {
| Ok(()) => {
if services
.moderation
@@ -160,8 +170,9 @@ impl CheckAuth for ServerSignatures {
Ok(output.origin)
},
| Err(err) =>
Err!(Request(Unauthorized(warn!("Failed to verify X-Matrix header: {err}")))),
| Err(err) => Err!(Request(Unauthorized(debug_warn!(
"Failed to verify X-Matrix header: {err}"
)))),
}
}
}
-10
View File
@@ -3,7 +3,6 @@ use std::cmp;
use axum::extract::State;
use conduwuit::{
Err, Event, PduCount, Result, info,
result::LogErr,
utils::{IterStream, ReadyExt, stream::TryTools},
};
use futures::{FutureExt, StreamExt, TryStreamExt};
@@ -80,15 +79,6 @@ pub(crate) async fn get_backfill_route(
.await
.then_some(pdu))
})
.and_then(async |mut pdu| {
// Strip the transaction ID, as that is private
pdu.remove_transaction_id().log_err().ok();
// Add age, as this is specified
pdu.add_age().log_err().ok();
// It's not clear if we should strip or add any more data, leave as
// is. In particular: Redaction?
Ok(pdu)
})
.try_filter_map(|pdu| async move {
Ok(services
.rooms
+2 -2
View File
@@ -3,7 +3,7 @@ use std::collections::{HashSet, VecDeque};
use axum::extract::State;
use conduwuit::{Err, Event, Result, debug, info, trace, utils::to_canonical_object, warn};
use ruma::{OwnedEventId, api::federation::event::get_missing_events};
use serde_json::{json, value::RawValue};
use serde_json::value::RawValue;
use service::rooms::event_handler::GET_MISSING_EVENTS_MAX_BATCH_SIZE;
use super::AccessCheck;
@@ -91,7 +91,7 @@ pub(crate) async fn get_missing_events_route(
.await
{
debug!(%next_event_id, origin = %body.identity, "redacting event origin cannot see");
pdu.redact(&room_version, json!({}))?;
pdu.redact(&room_version, None)?;
}
trace!(
+1 -2
View File
@@ -324,7 +324,7 @@ async fn validate_invite_state(
services
.server_keys
.verify_event(&state_event_json, room_version_rules)
.verify_event_json(&state_event_json, room_version_rules)
.await
.map_err(|e| {
err!(Request(InvalidParam("Signature verification failed on invite event: {e}")))
@@ -401,7 +401,6 @@ async fn validate_invite_create_event(
if !state_res::auth_check(
room_version_rules,
pdu,
None,
|_, _| async {
unreachable!("No state should be fetched when processing a lone create event");
},
+48 -38
View File
@@ -1,10 +1,8 @@
use std::{
mem::take,
time::{Duration, SystemTime},
};
use std::{collections::BTreeMap, mem::take, time::Duration};
use axum::{Json, extract::State, response::IntoResponse};
use conduwuit::{Result, utils::timepoint_from_now};
use futures::StreamExt;
use ruma::{
MilliSecondsSinceUnixEpoch,
api::{
@@ -14,33 +12,62 @@ use ruma::{
assign,
serde::Raw,
};
use service::{server_keys, server_keys::in_one_week};
/// # `GET /_matrix/key/v2/server`
///
/// Gets the public signing keys of this server.
///
/// - Matrix does not support invalidating public keys, so the key returned by
/// this will be valid forever.
// Response type for this endpoint is Json because we need to calculate a
// signature for the response
pub(crate) async fn get_server_keys_route(
State(services): State<crate::State>,
) -> Result<impl IntoResponse> {
let server_name = services.globals.server_name();
let active_key_id = services.server_keys.active_key_id();
let mut all_keys = services.server_keys.verify_keys_for(server_name).await;
let verify_keys = BTreeMap::from([services.server_keys.active_verify_key()]);
let verify_keys = all_keys
.remove_entry(active_key_id)
.expect("active verify_key is missing");
let old_verify_keys = all_keys
.into_iter()
.map(|(id, key)| (id, OldVerifyKey::new(expires_ts(), key.key)))
.collect();
let old_verify_keys = if let Some(k) = &services.config.old_verify_keys {
k.to_owned()
} else {
// We need to figure out any old signing keys we've acquired from
// notaries.
let mut keys = services.server_keys.signing_keys_for(server_name);
let mut old_keys = BTreeMap::new();
while let Some(resp) = keys.next().await {
// We need to verify that this response is still trusted based on
// the current configuration. It's possible we got this response
// from a notary who we no longer trust.
if resp.valid_until_ts > in_one_week() {
continue;
}
let trusted = services.config.trusted_servers.iter().any(|notary| {
server_keys::Service::verify_server_keys_response(
&resp,
Some((notary.server_name(), notary.verify_keys())),
)
.is_ok()
});
if !trusted {
continue;
}
for (old_key_id, old_key) in resp.old_verify_keys {
if old_key.expired_ts > resp.valid_until_ts {
// This key expired in the future which is probably illegal
continue;
}
old_keys
.entry(old_key_id)
.and_modify(|current_old_key: &mut OldVerifyKey| {
// Use the lowest expiry timestamp
if current_old_key.expired_ts > old_key.expired_ts {
*current_old_key = old_key.clone();
}
})
.or_insert(old_key);
}
}
old_keys
};
let server_key = assign!(ServerSigningKeys::new(server_name.to_owned(), valid_until_ts()), {
verify_keys: [verify_keys].into(),
verify_keys,
old_verify_keys,
});
@@ -56,24 +83,7 @@ pub(crate) async fn get_server_keys_route(
}
fn valid_until_ts() -> MilliSecondsSinceUnixEpoch {
let dur = Duration::from_hours(168);
let dur = Duration::from_hours(12);
let timepoint = timepoint_from_now(dur).expect("SystemTime should not overflow");
MilliSecondsSinceUnixEpoch::from_system_time(timepoint).expect("UInt should not overflow")
}
fn expires_ts() -> MilliSecondsSinceUnixEpoch {
let timepoint = SystemTime::now();
MilliSecondsSinceUnixEpoch::from_system_time(timepoint).expect("UInt should not overflow")
}
/// # `GET /_matrix/key/v2/server/{keyId}`
///
/// Gets the public signing keys of this server.
///
/// - Matrix does not support invalidating public keys, so the key returned by
/// this will be valid forever.
pub(crate) async fn get_server_keys_deprecated_route(
State(services): State<crate::State>,
) -> impl IntoResponse {
get_server_keys_route(State(services)).await
}
+1 -1
View File
@@ -142,7 +142,7 @@ pub(crate) async fn validate_any_membership_event(
services
.server_keys
.verify_event(&pdu, room_version_rules)
.verify_event_json(&pdu, room_version_rules)
.await
.map_err(|e| {
err!(Request(InvalidParam("Signature verification failed on membership event: {e}")))
-4
View File
@@ -80,7 +80,6 @@ futures.workspace = true
http-body-util.workspace = true
http.workspace = true
ipaddress.workspace = true
itertools.workspace = true
libc.workspace = true
libloading.workspace = true
libloading.optional = true
@@ -88,12 +87,9 @@ log.workspace = true
lettre.workspace = true
num-traits.workspace = true
rand.workspace = true
# tied to passwordhash 0.5.0
rand_core = { version = "0.6.4", features = ["getrandom"] }
regex.workspace = true
reqwest.workspace = true
sha2.workspace = true
assign.workspace = true
ruma.workspace = true
sanitize-filename.workspace = true
serde_json.workspace = true
+41 -2
View File
@@ -1,8 +1,8 @@
use std::env::consts::OS;
use std::{collections::HashSet, env::consts::OS};
use either::Either;
use figment::Figment;
use ruma::events::room::server_acl::RoomServerAclEventContent;
use ruma::{OwnedServerName, events::room::server_acl::RoomServerAclEventContent};
use super::DEPRECATED_KEYS;
use crate::{Config, Err, Result, Server, debug, debug_info, debug_warn, error, warn};
@@ -263,6 +263,18 @@ pub fn check(config: &Config) -> Result {
));
}
if config.smtp.as_ref().is_some_and(|f| {
f.connection_uri.as_ref().is_none_or(String::is_empty)
&& f.connection_uri_file
.as_ref()
.is_none_or(|f| f.as_os_str().is_empty())
}) {
return Err!(Config(
"connection_uri",
"If smtp is enabled, either connection_uri or connection_uri_file has to be defined."
));
}
match (&config.default_room_acl_allow, &config.default_room_acl_deny) {
| (Some(_), Some(_)) => {
return Err!(Config(
@@ -306,6 +318,33 @@ pub fn check(config: &Config) -> Result {
);
}
if config
.trusted_servers
.iter()
.any(|t| t.server_name() == config.server_name)
&& !config.federation_loopback
{
return Err!(Config(
"trusted_servers",
"Your own `server_name` cannot appear in `trusted_servers`"
));
}
config
.trusted_servers
.iter()
.map(super::TrustedServer::server_name)
.try_fold(HashSet::<OwnedServerName>::new(), |mut servers, server_name| {
if !servers.insert(server_name.to_owned()) {
Err!(Config(
"trusted_servers",
"Duplicate `server_name` in `trusted_servers`: {}",
server_name.as_str()
))
} else {
Ok(servers)
}
})?;
Ok(())
}
+163 -46
View File
@@ -20,8 +20,12 @@ use lettre::message::Mailbox;
use openidconnect::{ClientId, ClientSecret, Scope};
use regex::RegexSet;
use ruma::{
OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName, OwnedUserId, RoomVersionId,
api::client::{discovery::discover_support::ContactRole, rtc::RtcTransport},
OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
RoomVersionId, ServerName,
api::{
client::{discovery::discover_support::ContactRole, rtc::RtcTransport},
federation::discovery::OldVerifyKey,
},
profile::ProfileFieldName,
serde::Base64,
};
@@ -1085,52 +1089,92 @@ pub struct Config {
pub proxy: ProxyConfig,
/// Servers listed here will be used to gather public keys of other servers
/// (notary trusted key servers).
/// (trusted key notary servers), as well as serve as trusted servers for
/// other operations like backfill and event fetching.
///
/// Currently, continuwuity doesn't support inbound batched key requests, so
/// Currently, continuwuity doesn't support inbound key requests, so
/// this list should only contain other Synapse servers.
///
/// example: ["matrix.org", "tchncs.de"]
/// example: ["matrix.org", "starstruck.systems"]
///
/// It is possible to restrict which signing keys trusted servers are
/// allowed to sign responses with. Without configuring this, all responses
/// from trusted servers will be implicitly trusted, which is fine for most
/// users. Strict verification is only necessary if TLS interception is part
/// of your threat model. Even without strict verification, signatures from
/// the originating server must be valid, regardless of whether the trusted
/// server's is valid or not.
///
/// To enable strict validation, you need to pass a TOML table containing
/// the trusted server name, and any public keys (not key IDs!) that you
/// expect to sign responses. You can fetch the current public keys a remote
/// server uses with `!admin federation get-signing-keys <server name>`.
/// Only add public keys that aren't expired, and make sure to remove any
/// that expire at a later date!
///
/// Example:
/// ```ignore
/// trusted_servers = [{server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]}]
/// ```
///
/// You can also mix-and-match strict verification and lax verification
/// trusted servers:
///
/// ```ignore
/// trusted_servers = [
/// {server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]},
/// "matrix.org"
/// ]
/// ```
///
/// Trusted servers are queried in parallel, so order does not matter. You
/// should not have more than five entries. You can set this value to an
/// empty list (`[]`) to operate without trusted server assistance, but this
/// is discouraged for performance and reliability reasons.
///
/// default: ["matrix.org"]
#[serde(default = "default_trusted_servers")]
pub trusted_servers: Vec<OwnedServerName>,
pub trusted_servers: Vec<TrustedServer>,
/// Whether to query the servers listed in trusted_servers first or query
/// the origin server first. For best security, querying the origin server
/// first is advised to minimize the exposure to a compromised trusted
/// server. For maximum federation/join performance this can be set to true,
/// however other options exist to query trusted servers first under
/// specific high-load circumstances and should be evaluated before setting
/// this to true.
/// Whether to prioritise trusted server lookups over origin server lookups.
///
/// By default, both notaries and origin servers are queried in parallel,
/// and handled on a first-come-first-serve basis, meaning the server always
/// uses the fastest response(s).
///
/// If you wish to prioritise handling responses from trusted servers
/// *before* handling responses from origin servers, set this to true.
#[serde(default)]
pub query_trusted_key_servers_first: bool,
/// Whether to query the servers listed in trusted_servers first
/// specifically on room joins. This option limits the exposure to a
/// compromised trusted server to room joins only. The join operation
/// requires gathering keys from many origin servers which can cause
/// significant delays. Therefor this defaults to true to mitigate
/// unexpected delays out-of-the-box. The security-paranoid or those willing
/// to tolerate delays are advised to set this to false. Note that setting
/// query_trusted_key_servers_first to true causes this option to be
/// ignored.
#[serde(default = "true_fn")]
pub query_trusted_key_servers_first_on_join: bool,
/// Only query trusted servers for keys and never the origin server. This is
/// intended for clusters or custom deployments using their trusted_servers
/// as forwarding-agents to cache and deduplicate requests. Notary servers
/// do not act as forwarding-agents by default, therefor do not enable this
/// unless you know exactly what you are doing.
#[serde(default)]
pub only_query_trusted_key_servers: bool,
/// Maximum number of keys to request in each trusted server batch query.
/// Any old signing keys that were used to sign events using this server
/// name.
///
/// default: 1024
#[serde(default = "default_trusted_server_batch_size")]
pub trusted_server_batch_size: usize,
/// You do not need to populate this unless you previously used a different
/// server software with the same server_name configured, and then have
/// migrated to continuwuity.
///
/// The expiry timestamp should be as exact as you can get it, as making it
/// too old may inadvertently invalidate historical events sent by your
/// server, and potentially make it impossible for you to use some rooms as
/// a result. If your key was compromised, and you set the expiry timestamp
/// too late, some forged events may continue to be allowed.
///
/// If not configured, continuwuity will discover its own historical keys
/// through trusted servers. For improved security, you can set this to an
/// empty map ({}) to disable this behaviour, if you know you have no old
/// signing keys.
///
/// Example:
/// {"ed25519:1"={expired_ts=1790506890859,key="d29vZndvb2Z3b29md29vZg"}}
///
/// The map key should be the key ID, expired_ts should be unix
/// milliseconds, and the actual key value should be the unpadded base64
/// representation of the public key component of the expired signing key.
///
/// default:
#[serde(default)]
pub old_verify_keys: Option<BTreeMap<OwnedServerSigningKeyId, OldVerifyKey>>,
/// Max log level for continuwuity. Allows debug, info, warn, or error.
///
@@ -1758,11 +1802,10 @@ pub struct Config {
///
/// The authenticated equivalent endpoints are always enabled.
///
/// Defaults to true for now, but this is highly subject to change, likely
/// in the next release.
/// Defaults to false, as unauthenticated media has been sunsetted.
///
/// default: true
#[serde(default = "true_fn")]
/// default: false
#[serde(default)]
pub allow_legacy_media: bool,
/// If set to true, prevents fetching new legacy remote media.
@@ -2590,7 +2633,15 @@ pub struct SmtpConfig {
///
/// For a guide on the accepted URI syntax, consult Lettre's documentation:
/// https://docs.rs/lettre/latest/lettre/transport/smtp/struct.AsyncSmtpTransport.html#method.from_url
pub connection_uri: String,
pub connection_uri: Option<String>,
/// Same as `connection_uri`, except loaded from a file. If `connection_uri`
/// is defined, it is prioritized and `connection_uri_file` is ignored.
///
/// The file will be read once, when Continuwuity starts. It is not
/// currently reread when the server configuration is reloaded. If the file
/// cannot be read, Continuwuity will fail to start.
pub connection_uri_file: Option<PathBuf>,
/// The outgoing address which will be used for sending emails.
///
@@ -2831,6 +2882,45 @@ pub enum OidcProfileKeyImportMode {
OnLogin,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(untagged)]
pub enum TrustedServer {
Config(TrustedServerConfig),
Name(OwnedServerName),
}
impl TrustedServer {
#[must_use]
pub fn server_name(&self) -> &ServerName {
match self {
| Self::Name(server_name) => server_name,
| Self::Config(config) => &config.server_name,
}
}
#[must_use]
pub fn verify_keys(&self) -> &[Base64] {
let Self::Config(config) = self else {
return &[];
};
config.verify_keys.as_slice()
}
}
#[derive(Clone, Debug, Deserialize)]
pub struct TrustedServerConfig {
pub server_name: OwnedServerName,
#[serde(default)]
pub verify_keys: Vec<Base64>,
}
impl TrustedServerConfig {
#[must_use]
pub fn new(server_name: OwnedServerName) -> Self {
Self { server_name, verify_keys: Vec::new() }
}
}
const DEPRECATED_KEYS: &[&str] = &[
"cache_capacity",
"conduit_cache_capacity_modifier",
@@ -2846,6 +2936,26 @@ const DEPRECATED_KEYS: &[&str] = &[
];
impl Config {
/// Get the base domain to use for user-facing URLs.
#[must_use]
pub fn get_client_domain(&self) -> Url {
self.well_known.client.clone().unwrap_or_else(|| {
let host = self.server_name.host();
format!("https://{host}")
.as_str()
.try_into()
.expect("server name should be a valid host")
})
}
/// Contact for the VAPID `sub` claim.
#[must_use]
pub fn webpush_vapid_contact(&self) -> Url {
self.get_client_domain()
.join("/_continuwuity/about")
.expect("about page is a valid path")
}
/// Pre-initialize config
pub fn load(paths: &[PathBuf]) -> Result<Figment> {
let envs = [
@@ -3065,8 +3175,17 @@ fn default_otlp_protocol() -> String { "http".to_owned() }
fn default_tracing_flame_output_path() -> String { "./tracing.folded".to_owned() }
fn default_trusted_servers() -> Vec<OwnedServerName> {
vec![OwnedServerName::try_from("matrix.org").unwrap()]
fn default_trusted_servers() -> Vec<TrustedServer> {
// TODO(nex): Once we can be a notary, add maintainer(?) homeservers here.
// Rationale: Users are already running our code, arguably that's a higher
// level of trust than is assigned to notaries in the first place.
// We should still remind everyone that notaries are evil and out to get you
// and to replace this list with servers they actually trust.
let trusted_servers = vec![ruma::owned_server_name!("matrix.org")];
trusted_servers
.into_iter()
.map(TrustedServer::Name)
.collect()
}
/// do debug logging by default for debug builds
@@ -3203,8 +3322,6 @@ fn parallelism_scaled_u32(val: u32) -> u32 {
fn parallelism_scaled(val: usize) -> usize { val.saturating_mul(sys::available_parallelism()) }
fn default_trusted_server_batch_size() -> usize { 256 }
fn default_db_pool_workers() -> usize {
sys::available_parallelism()
.saturating_mul(4)
+1 -1
View File
@@ -100,7 +100,7 @@ macro_rules! err {
};
($variant:ident($($args:tt)+)) => {
$crate::error::Error::$variant($crate::format_maybe!($($args)+))
$crate::error::Error::$variant($crate::format_maybe!($($args)+), /* Cow<'static, str> */)
};
($level:ident!($($args:tt)+)) => {{
+1
View File
@@ -23,6 +23,7 @@ pub use self::{
id::{ShortId, *},
partial::PartialPdu,
raw_id::*,
unsigned::UnsignedContext,
};
use super::{Event, StateKey};
use crate::Result;
+11 -9
View File
@@ -1,10 +1,14 @@
use ruma::{RoomVersionId, canonical_json::redact_content_in_place};
use serde_json::{Value as JsonValue, json, value::to_raw_value};
use serde_json::{json, value::to_raw_value};
use crate::{Err, Result, err};
impl super::Pdu {
pub fn redact(&mut self, room_version_id: &RoomVersionId, reason: JsonValue) -> Result {
pub fn redact(
&mut self,
room_version_id: &RoomVersionId,
redacted_because: Option<&ruma::EventId>,
) -> Result {
let Some(rules) = room_version_id.rules() else {
return Err!("Cannot redact event for unknown room version {room_version_id}");
};
@@ -20,15 +24,13 @@ impl super::Pdu {
redact_content_in_place(&mut content, &rules.redaction, self.kind.to_string());
let reason = serde_json::to_value(reason).expect("Failed to preserialize reason");
let redacted_because = json!({
"redacted_because": reason,
});
self.unsigned = to_raw_value(&redacted_because)
if let Some(event_id) = redacted_because {
self.unsigned = to_raw_value(&json!({
"org.continuwuity.redacted_by": event_id,
}))
.expect("Failed to serialize unsigned")
.into();
}
self.content = to_raw_value(&content).expect("Failed to serialize content");
+4 -5
View File
@@ -64,7 +64,7 @@ fn nonsense_sticky_object_does_not_reject_the_pdu() {
#[test]
fn redaction_removes_stickiness() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.redact(&ruma::RoomVersionId::V11, serde_json::json!({}))
pdu.redact(&ruma::RoomVersionId::V11, None)
.expect("redaction succeeds");
assert!(pdu.sticky.is_none());
@@ -74,7 +74,7 @@ fn redaction_removes_stickiness() {
fn sticky_ttl_is_added_to_unsigned() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.origin_server_ts = ruma::MilliSecondsSinceUnixEpoch::now().get();
pdu.add_sticky_duration_ttl().expect("ttl is added");
pdu.set_unsigned(None).unwrap();
let unsigned: serde_json::Value =
serde_json::from_str(pdu.unsigned.as_deref().expect("unsigned is set").get())
@@ -88,8 +88,7 @@ fn sticky_ttl_is_added_to_unsigned() {
#[test]
fn no_ttl_for_events_that_are_not_sticky() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": "nonsense" }));
pdu.add_sticky_duration_ttl().expect("ttl is skipped");
let pdu = sticky_pdu(&serde_json::json!({ "duration_ms": "nonsense" }));
assert!(pdu.unsigned.is_none());
}
@@ -100,7 +99,7 @@ fn set_unsigned_adds_the_sticky_ttl() {
// section
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.origin_server_ts = ruma::MilliSecondsSinceUnixEpoch::now().get();
pdu.set_unsigned(None);
pdu.set_unsigned(None).unwrap();
let unsigned: serde_json::Value =
serde_json::from_str(pdu.unsigned.as_deref().expect("unsigned is set").get())
+78 -99
View File
@@ -1,112 +1,91 @@
use std::{borrow::Borrow, collections::BTreeMap};
use std::collections::BTreeMap;
use ruma::MilliSecondsSinceUnixEpoch;
use serde_json::value::{RawValue as RawJsonValue, Value as JsonValue, to_raw_value};
use ruma::{
MilliSecondsSinceUnixEpoch, UserId,
events::{AnyTimelineEvent, room::member::MembershipState},
serde::Raw,
};
use serde_json::value::{RawValue as RawJsonValue, to_raw_value};
use super::{Pdu, sticky};
use crate::{Result, err, result::LogErr};
use crate::Event;
type Unsigned = BTreeMap<String, Box<RawJsonValue>>;
#[derive(Default, Clone)]
pub struct UnsignedContext<'a> {
pub user_id: Option<&'a UserId>,
pub membership: Option<MembershipState>,
pub prev_content: Option<Box<serde_json::value::RawValue>>,
pub redacted_because: Option<Raw<AnyTimelineEvent>>,
}
impl Pdu {
/// Set the `unsigned` field of the PDU using only information in the PDU.
/// Some unsigned data is already set within the database (eg. prev events,
/// threads). Once this is done, other data must be calculated from the
/// database (eg. relations) This is for server-to-client events.
/// Backfill handles this itself.
pub fn set_unsigned(&mut self, user_id: Option<&ruma::UserId>) {
if Some(self.sender.borrow()) != user_id {
self.remove_transaction_id().log_err().ok();
/// Sets the `unsigned` field of the PDU using a mix of the provided
/// optional data, and information available in the PDU itself. The
/// `unsigned` field will always be inserted if it is not attached to the
/// PDU, however no operations will be performed if `unsigned` is present
/// but malformed and unparsable.
///
/// `age` is always inserted and is calculated based on the time of the
/// function call. `membership`, `prev_content`, and `redacted_by` are
/// inserted if not `None`. If `user_id` is `None`, `transaction_id` will be
/// removed. The sticky event TTL field is always inserted and calculated
/// (per `age`) if the PDU is sticky.
///
/// This function panics if any value cannot be serialised, which should not
/// happen provided `membership`, `prev_content`, and `redacted_because` are
/// well-formed.
pub fn set_unsigned(
&mut self,
context: Option<UnsignedContext<'_>>,
) -> crate::Result<Unsigned> {
// See: https://spec.matrix.org/v1.19/client-server-api/#definition-clientevent_unsigneddata
let mut unsigned = self
.unsigned()
.map_or_else(|| Ok(Unsigned::new()), |u| serde_json::from_str::<Unsigned>(u.get()))?;
let now = MilliSecondsSinceUnixEpoch::now().get();
let now_i: ruma::Int = now.into();
unsigned.insert(
"age".to_owned(),
to_raw_value(&now_i.saturating_sub(self.origin_server_ts.into()))?,
);
if let Some(context) = context {
if let Some(membership) = context.membership {
unsigned.insert("membership".to_owned(), to_raw_value(&membership)?);
}
if let Some(prev_content) = context.prev_content {
unsigned.insert("prev_content".to_owned(), to_raw_value(&prev_content)?);
}
if let Some(redacted_because) = context.redacted_because {
unsigned.remove("org.continuwuity.redacted_by");
unsigned.insert("redacted_because".to_owned(), to_raw_value(&redacted_because)?);
}
// replaces_state is embedded and always included.
if context.user_id.is_none_or(|u| u != self.sender()) {
unsigned.remove("transaction_id");
}
} else {
unsigned.remove("transaction_id");
}
self.add_age().log_err().ok();
self.add_sticky_duration_ttl().log_err().ok();
}
pub fn remove_transaction_id(&mut self) -> Result {
use BTreeMap as Map;
let Some(unsigned) = &self.unsigned else {
return Ok(());
};
let mut unsigned: Map<&str, Box<RawJsonValue>> = serde_json::from_str(unsigned.get())
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
unsigned.remove("transaction_id");
self.unsigned = to_raw_value(&unsigned)
.map(Some)
.expect("unsigned is valid");
Ok(())
}
pub fn add_age(&mut self) -> Result {
use BTreeMap as Map;
let mut unsigned: Map<&str, Box<RawJsonValue>> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
// deliberately allowing for the possibility of negative age
let now: i128 = MilliSecondsSinceUnixEpoch::now().get().into();
let then: i128 = self.origin_server_ts.into();
let this_age = now.saturating_sub(then);
unsigned.insert("age", to_raw_value(&this_age)?);
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
}
pub fn add_sticky_duration_ttl(&mut self) -> Result {
use BTreeMap as Map;
let now = u64::from(MilliSecondsSinceUnixEpoch::now().get());
let Some(expires_at) = self
if let Some(expires_at) = self
.sticky
.as_deref()
.and_then(|sticky| sticky::expires_at(self.origin_server_ts, sticky, now))
else {
return Ok(());
};
let mut unsigned: Map<&str, Box<RawJsonValue>> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
unsigned.insert(sticky::TTL_UNSIGNED_KEY, to_raw_value(&expires_at.saturating_sub(now))?);
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
}
pub fn add_relation(&mut self, name: &str, pdu: Option<&Self>) -> Result {
use serde_json::Map;
let mut unsigned: Map<String, JsonValue> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
let pdu = pdu
.map(serde_json::to_value)
.transpose()?
.unwrap_or_else(|| JsonValue::Object(Map::new()));
unsigned
.entry("m.relations")
.or_insert(JsonValue::Object(Map::new()))
.as_object_mut()
.map(|object| object.insert(name.to_owned(), pdu));
.and_then(|sticky| sticky::expires_at(self.origin_server_ts, sticky, u64::from(now)))
{
unsigned.insert(
sticky::TTL_UNSIGNED_KEY.to_owned(),
to_raw_value(&expires_at.saturating_sub(u64::from(now)))?,
);
}
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
Ok(unsigned)
}
}
+250 -69
View File
@@ -5,17 +5,21 @@ use futures::{
future::{OptionFuture, join, join3},
};
use ruma::{
Int, OwnedUserId, RoomVersionId, UserId,
AnyKeyName, CanonicalJsonObject, Int, OwnedUserId, RoomVersionId, SigningKeyId, UserId,
events::room::{
join_rules::{JoinRule, RoomJoinRulesEventContent},
member::{MembershipState, ThirdPartyInvite},
member::MembershipState,
power_levels::{RoomPowerLevelsEventContent, UserPowerLevel},
third_party_invite::PublicKey,
},
int,
room_version_rules::{RoomIdFormatVersion, RoomVersionRules},
serde::Raw,
serde::{Raw, base64, base64::Standard},
signatures,
signatures::to_canonical_json_string_for_signing,
third_party_invite::IdentityServerBase64PublicKey,
};
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue};
use super::{
@@ -25,7 +29,7 @@ use super::{
deserialize_power_levels_content_redact,
},
};
use crate::{debug, error, trace, warn};
use crate::{debug, err, error, trace, warn};
// FIXME: field extracting could be bundled for `content`
#[derive(Deserialize)]
@@ -48,6 +52,40 @@ struct RoomCreateContentFields {
federate: bool,
}
// Workaround for https://github.com/matrix-org/matrix-spec/issues/2471
#[derive(Deserialize, Debug)]
struct RoomThirdPartyInviteContentFields {
public_key: Option<IdentityServerBase64PublicKey>,
public_keys: Option<Vec<PublicKey>>,
}
// same here sort of (maintainers see https://forgejo.ellis.link/continuwuation/continuwuity-sec/issues/41)
#[derive(Deserialize, Debug)]
struct MemberThirdPartyInviteSignedContent {
signed: ThirdPartyInviteSignedObject,
}
#[derive(Serialize, Deserialize, Debug)]
struct ThirdPartyInviteSignedObject(CanonicalJsonObject);
impl ThirdPartyInviteSignedObject {
#[inline]
fn mxid(&self) -> Option<OwnedUserId> {
self.0
.get("mxid")?
.as_str()
.and_then(|raw| UserId::parse(raw).ok())
}
#[inline]
fn token(&self) -> Option<&str> { self.0.get("token")?.as_str() }
#[inline]
fn signatures(&self) -> Option<CanonicalJsonObject> {
self.0.get("signatures")?.as_object().map(ToOwned::to_owned)
}
}
/// For the given event `kind` what are the relevant auth events that are needed
/// to authenticate this `content`.
///
@@ -61,7 +99,7 @@ pub fn auth_types_for_event(
state_key: Option<&str>,
content: &RawJsonValue,
room_version: &RoomVersionRules,
) -> serde_json::Result<Vec<(StateEventType, StateKey)>> {
) -> crate::Result<Vec<(StateEventType, StateKey)>> {
if kind == &TimelineEventType::RoomCreate {
return Ok(vec![]);
}
@@ -84,7 +122,7 @@ pub fn auth_types_for_event(
#[allow(unused)]
struct RoomMemberContentFields {
membership: Option<Raw<MembershipState>>,
third_party_invite: Option<Raw<ThirdPartyInvite>>,
third_party_invite: Option<Raw<MemberThirdPartyInviteSignedContent>>,
join_authorised_via_users_server: Option<Raw<OwnedUserId>>,
}
@@ -116,16 +154,24 @@ pub fn auth_types_for_event(
auth_types.push(key);
}
// TODO: restore this once 3pid support isn't broken
// if membership == MembershipState::Invite {
// if let Some(Ok(t_id)) = content.third_party_invite.map(|t|
// t.deserialize()) { let key =
// (StateEventType::RoomThirdPartyInvite,
// t_id.signed.token.into()); if !auth_types.contains(&
// key) { auth_types.push(key);
// }
// }
// }
if membership == MembershipState::Invite {
if let Some(Ok(t_id)) = content.third_party_invite.map(|t| t.deserialize()) {
let key = (
StateEventType::RoomThirdPartyInvite,
t_id.signed
.token()
.ok_or_else(|| {
err!(Request(BadJson(
"Third party invite content missing a token"
)))
})?
.into(),
);
if !auth_types.contains(&key) {
auth_types.push(key);
}
}
}
}
}
}
@@ -179,12 +225,11 @@ fn get_user_power_level(
pub async fn auth_check<E, F, Fut>(
room_version: &RoomVersionRules,
incoming_event: &E,
current_third_party_invite: Option<&E>,
fetch_state: F,
create_event: &E,
) -> Result<bool, Error>
where
F: Fn(&StateEventType, &str) -> Fut + Send,
F: Fn(&StateEventType, &str) -> Fut + Send + Copy,
Fut: Future<Output = Option<E>> + Send,
E: Event + Send + Sync,
for<'a> &'a E: Event + Send,
@@ -444,13 +489,15 @@ where
sender,
sender_member_event.as_ref(),
incoming_event,
current_third_party_invite,
fetch_state,
power_levels_event.as_ref(),
join_rules_event.as_ref(),
user_for_join_auth.as_deref(),
&user_for_join_auth_membership,
&room_create_event,
)? {
)
.await?
{
return Ok(false);
}
@@ -639,14 +686,14 @@ where
/// event and the current State.
#[allow(clippy::too_many_arguments)]
#[allow(clippy::cognitive_complexity)]
fn valid_membership_change<E>(
async fn valid_membership_change<E, F, Fut>(
room_version: &RoomVersionRules,
target_user: &UserId,
target_user_membership_event: Option<&E>,
sender: &UserId,
sender_membership_event: Option<&E>,
current_event: &E,
current_third_party_invite: Option<&E>,
fetch_state: F,
power_levels_event: Option<&E>,
join_rules_event: Option<&E>,
user_for_join_auth: Option<&UserId>,
@@ -655,11 +702,13 @@ fn valid_membership_change<E>(
) -> Result<bool>
where
E: Event + Send + Sync,
F: Fn(&StateEventType, &str) -> Fut + Send + Copy,
Fut: Future<Output = Option<E>> + Send,
for<'a> &'a E: Event + Send,
{
#[derive(Deserialize)]
struct GetThirdPartyInvite {
third_party_invite: Option<Raw<ThirdPartyInvite>>,
third_party_invite: Option<Raw<MemberThirdPartyInviteSignedContent>>,
}
let create_content = from_json_str::<RoomCreateContentFields>(create_room.content().get())?;
let creator = if room_version.authorization.use_room_create_sender {
@@ -901,22 +950,18 @@ where
| MembershipState::Invite => {
// If content has third_party_invite key
trace!("starting target_membership=invite check");
match third_party_invite.and_then(|i| i.deserialize().ok()) {
| Some(tp_id) =>
match third_party_invite {
| Some(raw_tp_id) =>
if target_user_current_membership == MembershipState::Ban {
warn!(?target_user_membership_event_id, "Can't invite banned user");
false
} else {
let allow = verify_third_party_invite(
Some(target_user),
sender,
&tp_id,
current_third_party_invite,
);
if !allow {
warn!("Third party invite invalid");
}
allow
let Ok(tp_id) = raw_tp_id.deserialize() else {
warn!("Invite third party content is invalid");
return Ok(false);
};
verify_third_party_invite(Some(target_user), sender, &tp_id, fetch_state)
.await
},
| _ =>
if !sender_is_joined {
@@ -1120,9 +1165,6 @@ fn can_send_event(
ple: Option<&impl Event>,
user_level: UserPowerLevel,
) -> bool {
if user_level == UserPowerLevel::Infinite {
return true;
}
let event_type_power_level = get_send_level(event.event_type(), event.state_key(), ple);
debug!(
@@ -1137,8 +1179,9 @@ fn can_send_event(
return false;
}
if event.state_key().is_some_and(|k| k.starts_with('@'))
&& event.state_key() != Some(event.sender().as_str())
if event
.state_key()
.is_some_and(|k| k.starts_with('@') && k != event.sender().as_str())
{
warn!(
?user_level,
@@ -1437,14 +1480,133 @@ fn get_send_level(
.unwrap_or_else(|| if state_key.is_some() { int!(50) } else { int!(0) })
}
fn verify_third_party_invite(
_target_user: Option<&UserId>,
_sender: &UserId,
_tp_id: &ThirdPartyInvite,
_current_third_party_invite: Option<&impl Event>,
) -> bool {
// TODO: implement proper verification here
true
async fn verify_third_party_invite<F, Fut, E>(
target_user: Option<&UserId>,
sender: &UserId,
tp_id: &MemberThirdPartyInviteSignedContent,
fetch_state: F,
) -> bool
where
F: Fn(&StateEventType, &str) -> Fut + Send,
Fut: Future<Output = Option<E>> + Send,
E: Event + Send + Sync,
{
// If content.third_party_invite does not have a signed property, reject.
// ^ This would be a deserialization error before this function call, which
// equates to a rejection
let signed = &tp_id.signed;
// If signed does not have mxid and token properties, reject.
let Some(mxid) = signed.mxid() else {
warn!("Invite third party signed content is missing or has invalid `mxid` property");
return false;
};
let Some(token) = signed.token() else {
warn!("Invite third party signed content is missing or has invalid `token` property");
return false;
};
if let Err(e) = mxid.validate_historical() {
warn!(error=?e, ?mxid, "Invite third party signed content has invalid `mxid` property");
return false;
}
// If mxid does not match state_key, reject.
// N.B. target_user is the state_key
if target_user.is_none_or(|u| u != mxid) {
warn!(?target_user, %mxid, "Invite third party mxid does not match membership state key");
return false;
}
// If there is no m.room.third_party_invite event in the current room state
// with state_key matching token, reject.
let Some(current_third_party_invite) =
fetch_state(&StateEventType::RoomThirdPartyInvite, token).await
else {
warn!("No third party invite associated with the invite's third party invite found");
return false;
};
let Ok(tpi_content) = current_third_party_invite
.get_content::<RoomThirdPartyInviteContentFields>()
.inspect_err(
|e| warn!(error=?e, "Third party invite event content is invalid (cannot deserialize)"),
)
else {
return false;
};
if current_third_party_invite.state_key() != Some(token) {
warn!(
state_key=?current_third_party_invite.state_key(),
%token,
"Third party invite state key mismatch with signed invite token"
);
return false;
}
// If sender does not match sender of the m.room.third_party_invite, reject.
if sender != current_third_party_invite.sender() {
warn!(
?sender,
third_party_invite_sender=%current_third_party_invite.sender(),
"Third party invite sender does not match invite membership sender"
);
return false;
}
// If any signature in signed matches any public key in the
// m.room.third_party_invite event, allow. The public keys are in content of
// m.room.third_party_invite as:
//
// A single public key in the public_key property.
// A list of public keys in the public_keys property.
// NOTE: Technically the two below operations shouldn't be fallible at this
// point in execution, but if we can't de/serialize them now, we won't be
// able to in the future, so rejecting the event is the right way to go.
// We log an error though since this is unexpected.
let Ok(signed_json) = to_canonical_json_string_for_signing(&signed.0).inspect_err(
|e| error!(error=?e, "Canonical signed object cannot be cast to a signing string"),
) else {
return false;
};
let signatures = signed
.signatures()
.unwrap_or_default() // Empty sigs object will never pass so this is fine
.values()
.filter_map(|signatures| signatures.as_object())
.flat_map(|signatures| {
signatures.iter().map(|(key, sig)| {
let key_id = SigningKeyId::<AnyKeyName>::parse(key).ok()?;
base64::Base64::<Standard>::parse(sig.as_str()?)
.map(|parsed| (key_id.algorithm(), parsed))
.ok()
})
})
.flatten()
.collect::<Vec<_>>();
for public_key_bytes in tpi_content
.public_key
.into_iter()
.chain(
tpi_content
.public_keys
.unwrap_or_default()
.iter()
.map(|pk| pk.public_key.clone()),
)
.filter_map(|pk| pk.decode().ok())
{
for (algorithm, signature) in &signatures {
if signatures::verify_canonical_json_bytes(
algorithm,
&public_key_bytes,
signature.as_bytes(),
signed_json.as_bytes(),
)
.is_ok()
{
return true;
}
}
}
warn!("Invite via third party was not signed by any associated public keys");
false
}
#[cfg(test)]
@@ -1463,7 +1625,7 @@ mod tests {
use serde_json::value::to_raw_value as to_raw_json_value;
use crate::{
matrix::{Event, EventTypeExt, Pdu as PduEvent},
matrix::{Event, EventTypeExt},
state_res::{
StateMap,
event_auth::valid_membership_change,
@@ -1474,8 +1636,8 @@ mod tests {
},
};
#[test]
fn test_ban_pass() {
#[tokio::test]
async fn test_ban_pass() {
let _ = tracing::subscriber::set_default(
tracing_subscriber::fmt().with_test_writer().finish(),
);
@@ -1497,6 +1659,8 @@ mod tests {
);
let fetch_state = |ty, key| auth_events.get(&(ty, key)).cloned();
let async_fetch_state =
|t: &StateEventType, k: &str| std::future::ready(fetch_state(t.to_owned(), k.into()));
let target_user = charlie();
let sender = alice();
@@ -1508,19 +1672,20 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
None,
&MembershipState::Leave,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
}
#[test]
fn test_join_non_creator() {
#[tokio::test]
async fn test_join_non_creator() {
let _ = tracing::subscriber::set_default(
tracing_subscriber::fmt().with_test_writer().finish(),
);
@@ -1542,6 +1707,8 @@ mod tests {
);
let fetch_state = |ty, key| auth_events.get(&(ty, key)).cloned();
let async_fetch_state =
|t: &StateEventType, k: &str| std::future::ready(fetch_state(t.to_owned(), k.into()));
let target_user = charlie();
let sender = charlie();
@@ -1553,19 +1720,20 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
None,
&MembershipState::Leave,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
}
#[test]
fn test_join_creator() {
#[tokio::test]
async fn test_join_creator() {
let _ = tracing::subscriber::set_default(
tracing_subscriber::fmt().with_test_writer().finish(),
);
@@ -1587,6 +1755,8 @@ mod tests {
);
let fetch_state = |ty, key| auth_events.get(&(ty, key)).cloned();
let async_fetch_state =
|t: &StateEventType, k: &str| std::future::ready(fetch_state(t.to_owned(), k.into()));
let target_user = alice();
let sender = alice();
@@ -1598,19 +1768,20 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
None,
&MembershipState::Leave,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
}
#[test]
fn test_ban_fail() {
#[tokio::test]
async fn test_ban_fail() {
let _ = tracing::subscriber::set_default(
tracing_subscriber::fmt().with_test_writer().finish(),
);
@@ -1632,6 +1803,8 @@ mod tests {
);
let fetch_state = |ty, key| auth_events.get(&(ty, key)).cloned();
let async_fetch_state =
|t: &StateEventType, k: &str| std::future::ready(fetch_state(t.to_owned(), k.into()));
let target_user = alice();
let sender = charlie();
@@ -1643,19 +1816,20 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
None,
&MembershipState::Leave,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
}
#[test]
fn test_restricted_join_rule() {
#[tokio::test]
async fn test_restricted_join_rule() {
let _ = tracing::subscriber::set_default(
tracing_subscriber::fmt().with_test_writer().finish(),
);
@@ -1694,6 +1868,8 @@ mod tests {
);
let fetch_state = |ty, key| auth_events.get(&(ty, key)).cloned();
let async_fetch_state =
|t: &StateEventType, k: &str| std::future::ready(fetch_state(t.to_owned(), k.into()));
let target_user = ella();
let sender = ella();
@@ -1705,13 +1881,14 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
Some(alice()),
&MembershipState::Join,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
@@ -1723,19 +1900,20 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
Some(ella()),
&MembershipState::Leave,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
}
#[test]
fn test_knock() {
#[tokio::test]
async fn test_knock() {
let _ = tracing::subscriber::set_default(
tracing_subscriber::fmt().with_test_writer().finish(),
);
@@ -1766,6 +1944,8 @@ mod tests {
);
let fetch_state = |ty, key| auth_events.get(&(ty, key)).cloned();
let async_fetch_state =
|t: &StateEventType, k: &str| std::future::ready(fetch_state(t.to_owned(), k.into()));
let target_user = ella();
let sender = ella();
@@ -1777,13 +1957,14 @@ mod tests {
sender,
fetch_state(StateEventType::RoomMember, sender.as_str().into()).as_ref(),
&requester,
None::<&PduEvent>,
&async_fetch_state,
fetch_state(StateEventType::RoomPowerLevels, "".into()).as_ref(),
fetch_state(StateEventType::RoomJoinRules, "".into()).as_ref(),
None,
&MembershipState::Leave,
&fetch_state(StateEventType::RoomCreate, "".into()).unwrap(),
)
.await
.unwrap()
);
}
+21 -8
View File
@@ -757,7 +757,8 @@ where
Some(state_key),
event.content(),
room_version,
)?;
)
.map_err(|e| Error::InvalidPdu(e.to_string()))?;
trace!(list = ?auth_types, event_id = event.event_id().as_str(), "auth types for event");
let mut auth_state = StateMap::new();
@@ -809,13 +810,26 @@ where
.await;
trace!(map = ?auth_state.keys().collect::<Vec<_>>(), event_id = event.event_id().as_str(), "auth state for event");
debug!(event_id = event.event_id().as_str(), "Running auth checks");
if *event.event_type() == StateEventType::RoomCreate.into()
&& event.state_key().is_some_and(str::is_empty)
{
// Inject the create event so that the call to auth_check doesn't
// explode. It's not used otherwise.
auth_state
.entry(StateEventType::RoomCreate.with_state_key(""))
.or_insert_with(|| event.clone());
} else {
// If this is not a create event, we must have the room create event
// in the auth state by now.
if !auth_state.contains_key(&StateEventType::RoomCreate.with_state_key("")) {
return Err(Error::NotFound(format!(
"m.room.create did not appear in the auth state for {}",
event.event_id()
)));
}
}
// The key for this is (eventType + a state_key of the signed token not
// sender) so search for it
let current_third_party = auth_state.iter().find_map(|(_, pdu)| {
(*pdu.event_type() == TimelineEventType::RoomThirdPartyInvite).then_some(pdu)
});
debug!(event_id = event.event_id().as_str(), "Running auth checks");
let fetch_state = |ty: &StateEventType, key: &str| {
future::ready(
@@ -828,7 +842,6 @@ where
let auth_result = auth_check(
room_version,
&event,
current_third_party,
fetch_state,
&fetch_state(&StateEventType::RoomCreate, "")
.await
+2
View File
@@ -44,5 +44,7 @@ pub fn unstable_features() -> BTreeMap<String, bool> {
("org.matrix.msc4155".to_owned(), true),
// profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466)
("computer.gingershaped.msc4466".to_owned(), true),
// web push (https://github.com/matrix-org/matrix-spec-proposals/pull/4174)
("org.matrix.msc4174".to_owned(), true),
])
}
+3 -4
View File
@@ -2,7 +2,7 @@ use std::sync::OnceLock;
use argon2::{
Algorithm, Argon2, Params, PasswordHash, PasswordHasher, PasswordVerifier, Version,
password_hash, password_hash::SaltString,
password_hash,
};
use crate::{Error, Result, err};
@@ -28,16 +28,15 @@ fn init_argon() -> Argon2<'static> {
}
pub(super) fn password(password: &str) -> Result<String> {
let salt = SaltString::generate(rand_core::OsRng);
ARGON
.get_or_init(init_argon)
.hash_password(password.as_bytes(), &salt)
.hash_password(password.as_bytes())
.map(|it| it.to_string())
.map_err(map_err)
}
pub(super) fn verify_password(password: &str, password_hash: &str) -> Result<()> {
let password_hash = PasswordHash::new(password_hash).map_err(map_err)?;
let password_hash = PasswordHash::new(password_hash).map_err(|e| map_err(e.into()))?;
ARGON
.get_or_init(init_argon)
.verify_password(password.as_bytes(), &password_hash)
+9 -1
View File
@@ -267,7 +267,15 @@ pub(super) static MAPS: &[Descriptor] = &[
..descriptor::RANDOM_SMALL
},
Descriptor {
name: "server_signingkeys",
name: "senderkey_webpushbackoff",
..descriptor::RANDOM_SMALL
},
Descriptor {
name: "senderkey_webpushstate",
..descriptor::RANDOM_SMALL
},
Descriptor {
name: "servernamekeyid_response",
..descriptor::RANDOM
},
Descriptor {
-1
View File
@@ -18,7 +18,6 @@ syn.workspace = true
quote.workspace = true
proc-macro2.workspace = true
itertools.workspace = true
cargo_toml.workspace = true
[lints]
workspace = true
-1
View File
@@ -111,7 +111,6 @@ http-body-util.workspace = true
hyper.workspace = true
hyper-util.workspace = true
log.workspace = true
assign.workspace = true
ruma.workspace = true
rustls.workspace = true
rustls.optional = true
+1
View File
@@ -21,6 +21,7 @@ unstable-msc4203 = []
[dependencies]
assign.workspace = true
http.workspace = true
ruma.workspace = true
serde = { workspace = true }
serde_json = { workspace = true }
+1
View File
@@ -5,3 +5,4 @@ pub mod draupnir_antispam;
pub mod invite_permission_config;
pub mod meowlnir_antispam;
pub mod policy;
pub mod pushers;
+36
View File
@@ -0,0 +1,36 @@
pub mod unstable {
use ruma::{
api::{auth_scheme::AccessToken, error::Error as MatrixError, request, response},
metadata,
};
metadata! {
method: POST,
rate_limited: false,
authentication: AccessToken,
history: {
unstable => "/_matrix/client/unstable/org.matrix.msc4174/pushers/ack",
}
}
#[request(error = MatrixError)]
pub struct Request {
pub app_id: String,
pub ack_token: String,
}
#[response(error = MatrixError)]
#[derive(Default)]
#[allow(clippy::empty_structs_with_brackets, reason = "required by #[response]")]
pub struct Response {}
impl Request {
#[must_use]
pub fn new(app_id: String, ack_token: String) -> Self { Self { app_id, ack_token } }
}
impl Response {
#[must_use]
pub fn new() -> Self { Self {} }
}
}
+69
View File
@@ -0,0 +1,69 @@
pub mod v3 {
use ruma::{
api::{auth_scheme::AccessToken, error::Error as MatrixError, request, response},
metadata,
serde::from_raw_json_value,
};
use serde::{Deserialize, Serialize, de};
use serde_json::value::RawValue as RawJsonValue;
use crate::pushers::Pusher;
metadata! {
method: GET,
rate_limited: false,
authentication: AccessToken,
history: {
1.0 => "/_matrix/client/r0/pushers",
1.1 => "/_matrix/client/v3/pushers",
}
}
#[request(error = MatrixError)]
#[derive(Default)]
#[allow(clippy::empty_structs_with_brackets, reason = "required by #[request]")]
pub struct Request {}
#[response(error = MatrixError)]
pub struct Response {
pub pushers: Vec<PusherWithActivation>,
}
#[derive(Clone, Debug, Serialize)]
pub struct PusherWithActivation {
#[serde(flatten)]
pub pusher: Pusher,
#[serde(skip_serializing_if = "Option::is_none")]
pub activated: Option<bool>,
}
#[derive(Deserialize)]
struct ActivationDeHelper {
activated: Option<bool>,
}
impl<'de> Deserialize<'de> for PusherWithActivation {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: de::Deserializer<'de>,
{
let json = Box::<RawJsonValue>::deserialize(deserializer)?;
let ActivationDeHelper { activated } = from_raw_json_value(&json)?;
let pusher = from_raw_json_value(&json)?;
Ok(Self { pusher, activated })
}
}
impl Request {
#[must_use]
pub fn new() -> Self { Self {} }
}
impl Response {
#[must_use]
pub fn new(pushers: Vec<PusherWithActivation>) -> Self { Self { pushers } }
}
}
+87
View File
@@ -0,0 +1,87 @@
pub mod ack;
pub mod get_pushers;
mod pusher_serde;
pub mod set_pusher;
use std::fmt;
pub use ruma::api::client::push::{EmailPusherData, PusherIds};
use ruma::{
push::{HttpPusherData, PushFormat},
serde::JsonObject,
};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize)]
pub struct Pusher {
#[serde(flatten)]
pub ids: PusherIds,
#[serde(flatten)]
pub kind: PusherKind,
pub app_display_name: String,
pub device_display_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_tag: Option<String>,
pub lang: String,
}
#[derive(Clone, Debug)]
pub enum PusherKind {
Http(HttpPusherData),
Email(EmailPusherData),
WebPush(WebPushPusherData),
Custom {
kind: String,
data: JsonObject,
},
}
#[derive(Clone, Serialize, Deserialize)]
pub struct WebPushPusherData {
pub url: String,
pub auth: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<PushFormat>,
#[serde(flatten, default, skip_serializing_if = "JsonObject::is_empty")]
pub data: JsonObject,
}
impl fmt::Debug for WebPushPusherData {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("WebPushPusherData")
.field("url", &self.url)
.field("auth", &"<redacted>")
.field("format", &self.format)
.field("data", &self.data)
.finish()
}
}
impl PusherKind {
#[must_use]
pub fn as_str(&self) -> &str {
match self {
| Self::Http(_) => "http",
| Self::Email(_) => "email",
| Self::WebPush(_) => "org.matrix.msc4174.webpush",
| Self::Custom { kind, .. } => kind,
}
}
#[must_use]
pub fn as_webpush(&self) -> Option<&WebPushPusherData> {
match self {
| Self::WebPush(data) => Some(data),
| _ => None,
}
}
}
+196
View File
@@ -0,0 +1,196 @@
use ruma::serde::from_raw_json_value;
use serde::{Deserialize, Serialize, de, ser::SerializeStruct};
use serde_json::value::RawValue as RawJsonValue;
use super::{Pusher, PusherIds, PusherKind};
#[derive(Debug, Deserialize)]
struct PusherDeHelper {
#[serde(flatten)]
ids: PusherIds,
app_display_name: String,
device_display_name: String,
profile_tag: Option<String>,
lang: String,
}
impl<'de> Deserialize<'de> for Pusher {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: de::Deserializer<'de>,
{
let json = Box::<RawJsonValue>::deserialize(deserializer)?;
let PusherDeHelper {
ids,
app_display_name,
device_display_name,
profile_tag,
lang,
} = from_raw_json_value(&json)?;
let kind = from_raw_json_value(&json)?;
Ok(Self {
ids,
kind,
app_display_name,
device_display_name,
profile_tag,
lang,
})
}
}
impl Serialize for PusherKind {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let mut st = serializer.serialize_struct("PusherKind", 2)?;
st.serialize_field("kind", self.as_str())?;
match self {
| Self::Http(data) => st.serialize_field("data", data)?,
| Self::Email(data) => st.serialize_field("data", data)?,
| Self::WebPush(data) => st.serialize_field("data", data)?,
| Self::Custom { data, .. } => st.serialize_field("data", data)?,
}
st.end()
}
}
#[derive(Debug, Deserialize)]
struct PusherKindDeHelper {
kind: String,
data: Box<RawJsonValue>,
}
impl<'de> Deserialize<'de> for PusherKind {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: de::Deserializer<'de>,
{
let json = Box::<RawJsonValue>::deserialize(deserializer)?;
let PusherKindDeHelper { kind, data } = from_raw_json_value(&json)?;
match kind.as_str() {
| "http" => from_raw_json_value(&data).map(Self::Http),
| "email" => from_raw_json_value(&data).map(Self::Email),
| "org.matrix.msc4174.webpush" => from_raw_json_value(&data).map(Self::WebPush),
| _ => Ok(Self::Custom { kind, data: from_raw_json_value(&data)? }),
}
}
}
#[cfg(test)]
mod tests {
use serde_json::{from_value as from_json_value, json, to_value as to_json_value};
use super::{Pusher, PusherKind};
#[test]
fn roundtrip_ruma_http_pusher() {
let stored = json!({
"pushkey": "abcdef",
"app_id": "my.matrix.app",
"kind": "http",
"data": {
"url": "https://push.example.org/_matrix/push/v1/notify",
"format": "event_id_only",
"default_payload": { "session_id": "abc" },
},
"app_display_name": "My Matrix App",
"device_display_name": "My Phone",
"profile_tag": "tag",
"lang": "en",
});
let pusher: Pusher = from_json_value(stored.clone()).unwrap();
assert!(matches!(pusher.kind, PusherKind::Http(_)));
assert_eq!(to_json_value(&pusher).unwrap(), stored);
}
#[test]
fn deserialize_legacy_append_field() {
let stored = json!({
"pushkey": "abcdef",
"app_id": "my.matrix.app",
"kind": "email",
"data": {},
"append": true,
"app_display_name": "My Matrix App",
"device_display_name": "My Phone",
"lang": "en",
});
let pusher: Pusher = from_json_value(stored).unwrap();
assert!(matches!(pusher.kind, PusherKind::Email(_)));
assert_eq!(pusher.profile_tag, None);
}
#[test]
fn roundtrip_webpush_pusher() {
let stored = json!({
"pushkey": "BLn9b-VR0ca83knDNZ32dCHGyjJp",
"app_id": "m.webpush",
"kind": "org.matrix.msc4174.webpush",
"data": {
"url": "https://updates.push.services.mozilla.com/wpush/v2/abc",
"auth": "_ordMnz7uTCmrpBTeUV4Bw",
"format": "event_id_only",
"default_payload": { "session_id": "abc" },
},
"app_display_name": "WebPush",
"device_display_name": "Firefox",
"lang": "en",
});
let pusher: Pusher = from_json_value(stored.clone()).unwrap();
let data = pusher.kind.as_webpush().unwrap();
assert_eq!(data.auth, "_ordMnz7uTCmrpBTeUV4Bw");
assert_eq!(data.data.len(), 1);
assert_eq!(to_json_value(&pusher).unwrap(), stored);
}
#[test]
fn roundtrip_pusher_with_activation() {
use crate::pushers::get_pushers::v3::PusherWithActivation;
let wire = json!({
"pushkey": "BLn9b-VR0ca83knDNZ32dCHGyjJp",
"app_id": "m.webpush",
"kind": "org.matrix.msc4174.webpush",
"data": {
"url": "https://updates.push.services.mozilla.com/wpush/v2/abc",
"auth": "_ordMnz7uTCmrpBTeUV4Bw",
},
"app_display_name": "WebPush",
"device_display_name": "Firefox",
"lang": "en",
"activated": true,
});
let pusher: PusherWithActivation = from_json_value(wire.clone()).unwrap();
assert_eq!(pusher.activated, Some(true));
assert_eq!(pusher.pusher.kind.as_str(), "org.matrix.msc4174.webpush");
assert_eq!(to_json_value(&pusher).unwrap(), wire);
}
#[test]
fn roundtrip_unknown_kind() {
let stored = json!({
"pushkey": "abcdef",
"app_id": "my.matrix.app",
"kind": "my.custom.kind",
"data": { "whatever": 1 },
"app_display_name": "App",
"device_display_name": "Device",
"lang": "en",
});
let pusher: Pusher = from_json_value(stored.clone()).unwrap();
assert_eq!(pusher.kind.as_str(), "my.custom.kind");
assert_eq!(to_json_value(&pusher).unwrap(), stored);
}
}
+129
View File
@@ -0,0 +1,129 @@
pub mod v3 {
use ruma::{
JsOption,
api::{
EmptyBody, IncomingResponse, OutgoingResponse,
auth_scheme::AccessToken,
error::{DeserializationError, Error as MatrixError, IntoHttpError},
request,
},
metadata,
serde::from_raw_json_value,
};
use serde::{Deserialize, Serialize, de};
use serde_json::value::RawValue as RawJsonValue;
use crate::pushers::{Pusher, PusherIds};
metadata! {
method: POST,
rate_limited: true,
authentication: AccessToken,
history: {
1.0 => "/_matrix/client/r0/pushers/set",
1.1 => "/_matrix/client/v3/pushers/set",
}
}
#[request(error = MatrixError)]
pub struct Request {
#[ruma_api(body)]
pub action: PusherAction,
}
#[derive(Clone, Debug, Default)]
pub struct Response {
pub needs_activation: bool,
}
impl Request {
#[must_use]
pub fn new(action: PusherAction) -> Self { Self { action } }
}
impl Response {
#[must_use]
pub fn new(needs_activation: bool) -> Self { Self { needs_activation } }
}
#[cfg(feature = "server")]
impl OutgoingResponse for Response {
type Body = EmptyBody<false>;
fn try_into_http_response_inner(
self,
) -> Result<http::Response<Self::Body>, IntoHttpError> {
let status = if self.needs_activation {
http::StatusCode::CREATED
} else {
http::StatusCode::OK
};
http::Response::builder()
.status(status)
.header(http::header::CONTENT_TYPE, ruma::http_headers::APPLICATION_JSON)
.body(EmptyBody)
.map_err(Into::into)
}
}
#[cfg(feature = "client")]
impl IncomingResponse for Response {
type EndpointError = MatrixError;
fn try_from_http_response_inner(
response: http::Response<&[u8]>,
) -> Result<Self, DeserializationError> {
Ok(Self {
needs_activation: response.status() == http::StatusCode::CREATED,
})
}
}
#[derive(Clone, Debug)]
pub enum PusherAction {
Post(Box<Pusher>),
Delete(PusherIds),
}
#[derive(Debug, Deserialize)]
struct PusherActionDeHelper {
kind: JsOption<String>,
}
impl<'de> Deserialize<'de> for PusherAction {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: de::Deserializer<'de>,
{
let json = Box::<RawJsonValue>::deserialize(deserializer)?;
let PusherActionDeHelper { kind } = from_raw_json_value(&json)?;
match kind {
| JsOption::Some(_) => Ok(Self::Post(from_raw_json_value(&json)?)),
| JsOption::Null => Ok(Self::Delete(from_raw_json_value(&json)?)),
| JsOption::Undefined => Err(de::Error::missing_field("kind")),
}
}
}
impl Serialize for PusherAction {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
| Self::Post(pusher) => pusher.serialize(serializer),
| Self::Delete(ids) => {
use serde::ser::SerializeStruct;
let mut st = serializer.serialize_struct("PusherAction", 3)?;
st.serialize_field("pushkey", &ids.pushkey)?;
st.serialize_field("app_id", &ids.app_id)?;
st.serialize_field("kind", &None::<&str>)?;
st.end()
},
}
}
}
}
+4 -1
View File
@@ -88,6 +88,7 @@ futures.workspace = true
governor.workspace = true
hickory-resolver.workspace = true
http.workspace = true
httpdate.workspace = true
image.workspace = true
image.optional = true
ipaddress.workspace = true
@@ -96,7 +97,7 @@ log.workspace = true
loole.workspace = true
lru-cache.workspace = true
nonzero_ext.workspace = true
rand.workspace = true
p256.workspace = true
regex.workspace = true
reqwest.workspace = true
assign.workspace = true
@@ -113,6 +114,7 @@ termimad.optional = true
tokio.workspace = true
tracing.workspace = true
url.workspace = true
web-push-native.workspace = true
webpage.workspace = true
webpage.optional = true
recaptcha-verify = { version = "0.2.0", default-features = false }
@@ -122,6 +124,7 @@ lettre.workspace = true
resolvematrix.workspace = true
serde_urlencoded.workspace = true
openidconnect.workspace = true
rand.workspace = true
[target.'cfg(all(unix, target_os = "linux"))'.dependencies]
sd-notify.workspace = true
+1 -1
View File
@@ -399,7 +399,7 @@ impl Service {
let mut stream = admin_users;
while let Some(user_id) = stream.next().await {
generated_admin_list.push(user_id.clone());
generated_admin_list.push(user_id);
}
}
}
+11
View File
@@ -24,6 +24,7 @@ pub struct Service {
pub sender: reqwest::Client,
pub appservice: reqwest::Client,
pub pusher: reqwest::Client,
pub webpush: reqwest::Client,
pub cidr_range_denylist: Vec<IPAddress>,
}
@@ -141,6 +142,16 @@ impl crate::Service for Service {
.redirect(redirect::Policy::limited(2))
.build()?,
// MSC4174 recommends against following redirects, since the destination
// is only checked before the request is sent.
webpush: base(config)?
.connect_timeout(Duration::from_secs(config.pusher_conn_timeout))
.timeout(Duration::from_secs(config.pusher_timeout))
.pool_max_idle_per_host(1)
.pool_idle_timeout(Duration::from_secs(config.pusher_idle_timeout))
.redirect(redirect::Policy::none())
.build()?,
cidr_range_denylist: config
.ip_range_denylist
.iter()
-13
View File
@@ -6,7 +6,6 @@ use conduwuit::{
config::{Config, check},
error,
};
use url::Url;
use crate::registration_tokens::{ValidToken, ValidTokenSource};
@@ -53,18 +52,6 @@ impl Service {
.map(|token| ValidToken { token, source: ValidTokenSource::Config })
}
/// Get the base domain to use for user-facing URLs.
#[must_use]
pub fn get_client_domain(&self) -> Url {
self.well_known.client.clone().unwrap_or_else(|| {
let host = self.server_name.host();
format!("https://{host}")
.as_str()
.try_into()
.expect("server name should be a valid host")
})
}
fn handle_reload(&self) -> Result {
if self.server.config.config_reload_signal {
#[cfg(all(feature = "systemd", target_os = "linux"))]
+2 -2
View File
@@ -14,7 +14,7 @@ use ruma::{
SupportedVersions,
auth_scheme::{AuthScheme, NoAuthentication},
error::Error as RumaError,
federation::authentication::{ServerSignatures, ServerSignaturesInput},
federation::authentication::{ServerSignatures, XMatrixSigningInput},
path_builder::PathBuilder,
},
};
@@ -92,7 +92,7 @@ impl super::Service {
PathBuilder: PathBuilder<Input<'i>: FederationPathBuilderInput>,
> + Send,
{
let authentication = ServerSignaturesInput::new(
let authentication = XMatrixSigningInput::new(
self.services.server.name.clone(),
dest.to_owned(),
self.services.server_keys.keypair(),
+21 -20
View File
@@ -142,26 +142,27 @@ impl Service {
/// Returns a rate-limited error if the remote is unhealthy.
fn ensure_remote_is_healthy(&self, server_name: &ServerName) -> Result<()> {
if self.is_healthy(server_name) {
Ok(())
} else {
let retry_after = self
.retry_after(server_name)
.expect("remote is unhealthy and must have an accompanying retry timestamp");
Err(Error::Request(
ErrorKind::LimitExceeded(assign!(LimitExceededErrorData::new(), {
retry_after: Some(RetryAfter::Delay(retry_after)),
})),
format!(
"Remote server {} is currently unhealthy (not retrying for another {} \
seconds)",
server_name,
retry_after.as_secs()
)
.into(),
StatusCode::TOO_MANY_REQUESTS,
))
}
// Read the backoff window once. The remote can be marked healthy
// between two lookups.
let Some(retry_after) = self
.retry_after(server_name)
.filter(|retry_after| !retry_after.is_zero())
else {
return Ok(());
};
Err(Error::Request(
ErrorKind::LimitExceeded(assign!(LimitExceededErrorData::new(), {
retry_after: Some(RetryAfter::Delay(retry_after)),
})),
format!(
"Remote server {} is currently unhealthy (not retrying for another {} seconds)",
server_name,
retry_after.as_secs()
)
.into(),
StatusCode::TOO_MANY_REQUESTS,
))
}
/// Marks a destination as stale, which will cause the destination cache to
+1 -3
View File
@@ -6,7 +6,7 @@ use async_trait::async_trait;
use conduwuit::{Result, Server, SyncRwLock, error, utils::bytes::pretty};
use data::Data;
use regex::RegexSet;
use ruma::{OwnedEventId, OwnedRoomAliasId, OwnedServerName, OwnedUserId, ServerName, UserId};
use ruma::{OwnedEventId, OwnedRoomAliasId, OwnedUserId, ServerName, UserId};
use crate::service;
@@ -106,8 +106,6 @@ impl Service {
self.server.config.allow_announcements_check
}
pub fn trusted_servers(&self) -> &[OwnedServerName] { &self.server.config.trusted_servers }
pub fn turn_password(&self) -> &String { &self.server.config.turn_password }
pub fn turn_ttl(&self) -> u64 { self.server.config.turn_ttl }
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff. Show more