Skip to content

Prototype Matrix E2EE gates#177

Closed
bglusman wants to merge 0 commit into
mainfrom
exp/matrix-e2ee-prototype-codex
Closed

Prototype Matrix E2EE gates#177
bglusman wants to merge 0 commit into
mainfrom
exp/matrix-e2ee-prototype-codex

Conversation

@bglusman
Copy link
Copy Markdown
Owner

Summary

Experimental Matrix E2EE investigation branch. This does not claim encrypted Matrix chat works yet.

  • Updates the optional Matrix SDK dependency to 0.17 and gates it behind channel-matrix-e2ee.
  • Adds matrix_e2ee channel policy config plus store-path fields for the SDK prototype.
  • Fails closed for matrix_e2ee = "require" / "experimental-sdk" instead of silently using the raw HTTP plaintext runtime.
  • Adds an SDK builder probe that builds a Matrix client with persistent SQLite E2EE storage and touches the encryption API.
  • Adds ADR-style notes and Matrix docs explaining current status and remaining work.

Verification

  • cargo test -p calciforge matrix -- --nocapture
  • cargo test -p calciforge --features channel-matrix-e2ee matrix_e2ee -- --nocapture
  • cargo clippy -p calciforge --features channel-matrix-e2ee --all-targets -- -D warnings
  • ruby scripts/check-docs-site.rb
  • pre-commit gate on both commits: rustfmt, workspace clippy, staged gitleaks
  • pre-push gate: fmt, clippy, full unit/e2e/doc tests, loom tests

Notes

This is intentionally draft-only. The next real implementation slice is replacing the raw Matrix /sync loop with matrix-sdk while preserving Calciforge identity/routing/commands/artifacts.

Copilot AI review requested due to automatic review settings May 12, 2026 03:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an experimental, compile-time-gated Matrix E2EE “safety gate + SDK feasibility probe” to prevent encrypted-room configs from silently running the plaintext Matrix HTTP adapter, while documenting current limitations and next steps.

Changes:

  • Adds matrix_e2ee config mode(s) plus prototype store-path fields, and validates them (including failing closed for require / experimental-sdk).
  • Introduces a channel-matrix-e2ee feature that pulls in matrix-sdk v0.17 and a small builder probe module.
  • Updates Matrix channel docs and adds an ADR capturing the current investigation status and follow-up plan.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
docs/channels/matrix.md Documents the new matrix_e2ee policy gate and prototype config fields.
docs/adr/0003-matrix-e2ee-prototype.md Adds ADR notes describing feasibility, decision, and follow-up work for SDK-based E2EE.
crates/calciforge/src/config/validator.rs Adds Matrix channel validation, including matrix_e2ee mode-specific checks and tests.
crates/calciforge/src/config.rs Adds MatrixE2eeMode plus new Matrix E2EE-related config fields and parsing tests.
crates/calciforge/src/channels/mod.rs Gated export of the experimental matrix_e2ee module.
crates/calciforge/src/channels/matrix.rs Adds startup gating logic that fails closed for E2EE-required modes.
crates/calciforge/src/channels/matrix_e2ee.rs Adds an SDK client builder probe and a basic test (feature-gated).
crates/calciforge/Cargo.toml Adds channel-matrix-e2ee feature and updates optional matrix-sdk to 0.17 with E2EE+SQLite features.
Cargo.lock Lockfile updates for the matrix-sdk 0.17 dependency graph and related transitive upgrades.

}
if channel.enabled && channel.allowed_users.is_empty() {
result.add_error(
"Matrix channel requires at least one allowed_user when enabled"
"Matrix channel sets matrix_e2ee_store_path, but matrix_e2ee is not experimental-sdk; the store path will be ignored"
.to_string(),
);
}
Comment thread crates/calciforge/src/config.rs Outdated
Comment on lines +401 to +403
/// `warn` to keep today's behavior, `require` to fail closed when the
/// configured room is not encrypted, or `experimental-sdk` only on builds
/// compiled with `channel-matrix-e2ee`.
Comment on lines 657 to 658
let is_encrypted =
check_room_encryption(&homeserver, &room_id_str, &http, &auth_header).await;
use matrix_sdk::Client;

// Kept compile-gated until the Matrix channel loop is SDK-backed.
#[allow(dead_code)]
Comment thread docs/adr/0003-matrix-e2ee-prototype.md Outdated

# ADR 0003: Matrix E2EE Prototype

Status: Experimental branch note
@bglusman bglusman force-pushed the exp/matrix-e2ee-prototype-codex branch from c63a013 to fa430a1 Compare May 13, 2026 12:18
Copilot AI review requested due to automatic review settings May 13, 2026 12:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Comment thread docs/channels/matrix.md
Comment on lines +13 to +18
> **End-to-end encryption requires the SDK runtime.** The default `warn`/`off`
> modes use the raw HTTP adapter, which receives plaintext `m.text` events and
> sends plaintext replies plus native media events for artifacts. Rooms where
> E2EE is required must use `matrix_e2ee = "require"` or
> `"experimental-sdk"` in a build compiled with `--features channel-matrix-e2ee`
> and a persistent SDK crypto store.
Comment on lines +280 to +286
"Matrix channel sets matrix_e2ee_store_path, but matrix_e2ee is not experimental-sdk; the store path will be ignored"
.to_string(),
);
}
if channel.matrix_e2ee_store_passphrase_file.is_some() {
result.add_warning(
"Matrix channel sets matrix_e2ee_store_passphrase_file, but matrix_e2ee is not experimental-sdk; the passphrase file will be ignored"
@bglusman bglusman closed this May 14, 2026
@bglusman bglusman force-pushed the exp/matrix-e2ee-prototype-codex branch from 8d7a443 to 80e3f7b Compare May 14, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants