WIP: feat: Fetch policy server signatures #1141

Draft
nex wants to merge 1 commit from nex/feat/ps-signing into main
Owner

Closes #1061

Implements fetching policy server signatures for locally generated events including fallback legacy checks.

This needs implementing rather soon as the legacy checks will not be around forever (and thus blocks the 0.5.0 release)

Closes #1061 Implements fetching policy server signatures for locally generated events including fallback legacy checks. This needs implementing rather soon as the legacy checks will not be around forever (and thus blocks the 0.5.0 release)
nex added this to the 0.5.0 milestone 2025-11-02 05:10:01 +00:00
nex self-assigned this 2025-11-02 05:10:01 +00:00
feat: Fetch policy server signatures
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Successful in 4m35s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 3m39s
Update flake hashes / update-flake-hashes (pull_request) Successful in 24s
Release Docker Image / Build linux-arm64 (release) (pull_request) Successful in 11m31s
Release Docker Image / Build linux-amd64 (release) (pull_request) Successful in 11m55s
Release Docker Image / Create Multi-arch Release Manifest (pull_request) Successful in 21s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 31m43s
Release Docker Image / Build linux-amd64 (max-perf) (pull_request) Successful in 24m31s
Release Docker Image / Build linux-arm64 (max-perf) (pull_request) Successful in 17m45s
Release Docker Image / Create Max-Perf Manifest (pull_request) Successful in 15s
7b1ba47b48
Author
Owner

Does not currently work due to some weird deserialisation:

2025-11-02T05:05:45.493925Z  INFO router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}: conduwuit_service::rooms::event_handler::policy_server: Getting policy server signature on event via=nexy7574.co.uk outgoing={"auth_events": Array([String("$z04DmPQlaa86ZMFkELfxsfF_uOo6WYBe0nTxh3vfg-g"), String("$OeiR8Se0XztaDE2b1YnhUsNvNuCyeWA0i4jkV6Iopqs"), String("$zhXU3iHs8l6yzGKiunCSMByR_ytYXS6ft2QGbYEGtUA")]), "content": Object({"body": String("a"), "com.beeper.linkpreviews": Array([]), "m.mentions": Object({}), "msgtype": String("m.text")}), "depth": 260, "event_id": String("$FxVq6wjM8hW297WSLuN6SZfImhcxxqO5dDESUCHUkKY"), "hashes": Object({"sha256": String("UYhz5t4fMLk56UxerLLsPXricrsuf5kbpuH1mkI9nuo")}), "origin": String("timedout.uk"), "origin_server_ts": 1762059945492, "prev_events": Array([String("$z04DmPQlaa86ZMFkELfxsfF_uOo6WYBe0nTxh3vfg-g")]), "room_id": String("!91OlC7li69yJKryLgA:nexy7574.co.uk"), "sender": String("@nex:timedout.uk"), "signatures": Object({"timedout.uk": Object({"ed25519:d5KG2RdS": String("kZQYytITPRMcuq1IaiyvboHcM2G5LhaBKTS1Epf4auTOeTNKYQC8kwTPBzKvQ+pKe52b6RuJ5J2teau8ZBBjDQ")})}), "type": String("m.room.message"), "unsigned": Object({"transaction_id": String("hicli-mautrix-go_1762059945427884209_2")})}
2025-11-02T05:05:45.493961Z DEBUG router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}:fetch_policy_server_signature: conduwuit_service::rooms::event_handler::policy_server: Requesting policy server signature
2025-11-02T05:05:45.566329Z DEBUG router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}:fetch_policy_server_signature: conduwuit_service::rooms::event_handler::policy_server: Response from policy server: Response { signatures: None }
2025-11-02T05:05:45.566528Z DEBUG router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}:fetch_policy_server_signature: conduwuit_service::rooms::event_handler::policy_server: Policy server refused to sign event
2025-11-02T05:05:45.566617Z  WARN router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}: conduwuit_service::rooms::timeline::create: Policy server marked this event as spam

This event was not, in fact, marked as spam:

2025-11-02T05:15:38.57Z TRC Checking event received by policy server component="policy server" destination_server_name=nexy7574.co.uk event={"auth_events":["$zhXU3iHs8l6yzGKiunCSMByR_ytYXS6ft2QGbYEGtUA","$OeiR8Se0XztaDE2b1YnhUsNvNuCyeWA0i4jkV6Iopqs","$z04DmPQlaa86ZMFkELfxsfF_uOo6WYBe0nTxh3vfg-g"],"content":{"body":"meow","com.beeper.linkpreviews":[],"m.mentions":{},"msgtype":"m.text"},"depth":262,"hashes":{"sha256":"AFo+MH7/fcRn3PS4X9M5hV+P8j2bp7aSKjChaRRg2Y8"},"origin":"timedout.uk","origin_server_ts":1762060538533,"prev_events":["$YEOC-KEbfFtZZZEOabPXeLpOji6hPgWkQWzB6xFzAVA"],"room_id":"!91OlC7li69yJKryLgA:nexy7574.co.uk","sender":"@nex:timedout.uk","signatures":{"timedout.uk":{"ed25519:d5KG2RdS":"aBv7r+QRy7+/uSRV+u8Y/fJ9dRs/ypVQG+g+Q2OWZYOhu+/41IrFo63SVZpce8mNP8+//Ijd8rTN/aBtM7ekDw"}},"type":"m.room.message","unsigned":{}} event_id=$ePfiiWOLB_pNd9DZiuolawVLexvGKHKOOW-cakgLk2w origin_server_name=timedout.uk request_id=d43ehujf8bflrpvugf0g room_id=!91OlC7li69yJKryLgA:nexy7574.co.uk
2025-11-02T05:15:38.571Z TRC Event accepted component="policy server" destination_server_name=nexy7574.co.uk event_id=$ePfiiWOLB_pNd9DZiuolawVLexvGKHKOOW-cakgLk2w origin_server_name=timedout.uk request_id=d43ehujf8bflrpvugf0g room_id=!91OlC7li69yJKryLgA:nexy7574.co.uk
2025-11-02T05:15:38.571Z INF Access component="policy server" host=nexy7574.co.uk:8448 method=POST proto=HTTP/1.1 remote_addr=10.11.10.121:40368 request_content_type=application/json request_id=d43ehujf8bflrpvugf0g request_length=697 request_time_ms=1 request_uri=/_matrix/policy/unstable/org.matrix.msc4284/sign response_content_type=application/json response_length=134 status_code=200 user_agent="continuwuity/0.5.0-rc.8 (7b1ba47b nex/feat/ps-signing)" x_forwarded_for=80.3.155.46
Does not currently work due to some weird deserialisation: ``` 2025-11-02T05:05:45.493925Z INFO router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}: conduwuit_service::rooms::event_handler::policy_server: Getting policy server signature on event via=nexy7574.co.uk outgoing={"auth_events": Array([String("$z04DmPQlaa86ZMFkELfxsfF_uOo6WYBe0nTxh3vfg-g"), String("$OeiR8Se0XztaDE2b1YnhUsNvNuCyeWA0i4jkV6Iopqs"), String("$zhXU3iHs8l6yzGKiunCSMByR_ytYXS6ft2QGbYEGtUA")]), "content": Object({"body": String("a"), "com.beeper.linkpreviews": Array([]), "m.mentions": Object({}), "msgtype": String("m.text")}), "depth": 260, "event_id": String("$FxVq6wjM8hW297WSLuN6SZfImhcxxqO5dDESUCHUkKY"), "hashes": Object({"sha256": String("UYhz5t4fMLk56UxerLLsPXricrsuf5kbpuH1mkI9nuo")}), "origin": String("timedout.uk"), "origin_server_ts": 1762059945492, "prev_events": Array([String("$z04DmPQlaa86ZMFkELfxsfF_uOo6WYBe0nTxh3vfg-g")]), "room_id": String("!91OlC7li69yJKryLgA:nexy7574.co.uk"), "sender": String("@nex:timedout.uk"), "signatures": Object({"timedout.uk": Object({"ed25519:d5KG2RdS": String("kZQYytITPRMcuq1IaiyvboHcM2G5LhaBKTS1Epf4auTOeTNKYQC8kwTPBzKvQ+pKe52b6RuJ5J2teau8ZBBjDQ")})}), "type": String("m.room.message"), "unsigned": Object({"transaction_id": String("hicli-mautrix-go_1762059945427884209_2")})} 2025-11-02T05:05:45.493961Z DEBUG router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}:fetch_policy_server_signature: conduwuit_service::rooms::event_handler::policy_server: Requesting policy server signature 2025-11-02T05:05:45.566329Z DEBUG router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}:fetch_policy_server_signature: conduwuit_service::rooms::event_handler::policy_server: Response from policy server: Response { signatures: None } 2025-11-02T05:05:45.566528Z DEBUG router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}:ask_policy_server{room_id="!91OlC7li69yJKryLgA:nexy7574.co.uk" incoming=false}:fetch_policy_server_signature: conduwuit_service::rooms::event_handler::policy_server: Policy server refused to sign event 2025-11-02T05:05:45.566617Z WARN router{method=PUT path=/_matrix/client/v3/rooms/:room_id/send/:event_type}:build_and_append_pdu{sender="@nex:timedout.uk" room_id=Some("!91OlC7li69yJKryLgA:nexy7574.co.uk")}: conduwuit_service::rooms::timeline::create: Policy server marked this event as spam ``` This event was not, in fact, marked as spam: ``` 2025-11-02T05:15:38.57Z TRC Checking event received by policy server component="policy server" destination_server_name=nexy7574.co.uk event={"auth_events":["$zhXU3iHs8l6yzGKiunCSMByR_ytYXS6ft2QGbYEGtUA","$OeiR8Se0XztaDE2b1YnhUsNvNuCyeWA0i4jkV6Iopqs","$z04DmPQlaa86ZMFkELfxsfF_uOo6WYBe0nTxh3vfg-g"],"content":{"body":"meow","com.beeper.linkpreviews":[],"m.mentions":{},"msgtype":"m.text"},"depth":262,"hashes":{"sha256":"AFo+MH7/fcRn3PS4X9M5hV+P8j2bp7aSKjChaRRg2Y8"},"origin":"timedout.uk","origin_server_ts":1762060538533,"prev_events":["$YEOC-KEbfFtZZZEOabPXeLpOji6hPgWkQWzB6xFzAVA"],"room_id":"!91OlC7li69yJKryLgA:nexy7574.co.uk","sender":"@nex:timedout.uk","signatures":{"timedout.uk":{"ed25519:d5KG2RdS":"aBv7r+QRy7+/uSRV+u8Y/fJ9dRs/ypVQG+g+Q2OWZYOhu+/41IrFo63SVZpce8mNP8+//Ijd8rTN/aBtM7ekDw"}},"type":"m.room.message","unsigned":{}} event_id=$ePfiiWOLB_pNd9DZiuolawVLexvGKHKOOW-cakgLk2w origin_server_name=timedout.uk request_id=d43ehujf8bflrpvugf0g room_id=!91OlC7li69yJKryLgA:nexy7574.co.uk 2025-11-02T05:15:38.571Z TRC Event accepted component="policy server" destination_server_name=nexy7574.co.uk event_id=$ePfiiWOLB_pNd9DZiuolawVLexvGKHKOOW-cakgLk2w origin_server_name=timedout.uk request_id=d43ehujf8bflrpvugf0g room_id=!91OlC7li69yJKryLgA:nexy7574.co.uk 2025-11-02T05:15:38.571Z INF Access component="policy server" host=nexy7574.co.uk:8448 method=POST proto=HTTP/1.1 remote_addr=10.11.10.121:40368 request_content_type=application/json request_id=d43ehujf8bflrpvugf0g request_length=697 request_time_ms=1 request_uri=/_matrix/policy/unstable/org.matrix.msc4284/sign response_content_type=application/json response_length=134 status_code=200 user_agent="continuwuity/0.5.0-rc.8 (7b1ba47b nex/feat/ps-signing)" x_forwarded_for=80.3.155.46 ```
nex force-pushed nex/feat/ps-signing from 7b1ba47b48
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Successful in 4m35s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 3m39s
Update flake hashes / update-flake-hashes (pull_request) Successful in 24s
Release Docker Image / Build linux-arm64 (release) (pull_request) Successful in 11m31s
Release Docker Image / Build linux-amd64 (release) (pull_request) Successful in 11m55s
Release Docker Image / Create Multi-arch Release Manifest (pull_request) Successful in 21s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 31m43s
Release Docker Image / Build linux-amd64 (max-perf) (pull_request) Successful in 24m31s
Release Docker Image / Build linux-arm64 (max-perf) (pull_request) Successful in 17m45s
Release Docker Image / Create Max-Perf Manifest (pull_request) Successful in 15s
to c4f1e0c485
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Successful in 51s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m40s
Update flake hashes / update-flake-hashes (pull_request) Successful in 11s
Release Docker Image / Build linux-amd64 (release) (pull_request) Successful in 7m10s
Release Docker Image / Build linux-arm64 (release) (pull_request) Successful in 7m18s
Release Docker Image / Create Multi-arch Release Manifest (pull_request) Successful in 16s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 15m25s
Release Docker Image / Build linux-amd64 (max-perf) (pull_request) Successful in 14m8s
Release Docker Image / Build linux-arm64 (max-perf) (pull_request) Successful in 14m33s
Release Docker Image / Create Max-Perf Manifest (pull_request) Successful in 16s
2025-11-11 20:38:34 +00:00
Compare
nex changed title from feat: Fetch policy server signatures to WIP: feat: Fetch policy server signatures 2025-11-20 23:53:19 +00:00
Author
Owner

Marking this as WIP until it's actually ready for review

Marking this as WIP until it's actually ready for review
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Successful in 51s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 2m40s
Required
Details
Update flake hashes / update-flake-hashes (pull_request) Successful in 11s
Release Docker Image / Build linux-amd64 (release) (pull_request) Successful in 7m10s
Release Docker Image / Build linux-arm64 (release) (pull_request) Successful in 7m18s
Release Docker Image / Create Multi-arch Release Manifest (pull_request) Successful in 16s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 15m25s
Required
Details
Release Docker Image / Build linux-amd64 (max-perf) (pull_request) Successful in 14m8s
Release Docker Image / Build linux-arm64 (max-perf) (pull_request) Successful in 14m33s
Release Docker Image / Create Max-Perf Manifest (pull_request) Successful in 16s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin nex/feat/ps-signing:nex/feat/ps-signing
git switch nex/feat/ps-signing
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
continuwuation/continuwuity!1141
No description provided.