matrix: e2e test for cross-signing auto-bootstrap

Self-contained docker-compose harness that exercises the new bootstrap
branch against a real Continuwuity homeserver. Three tests:

  1. fresh bot → bootstrap fires, /keys/query returns master + ssk
     with UNPADDED base64 keyids, current device is signed by the
     new SSK
  2. second startup with same crypto store → bootstrap is skipped
  3. MATRIX_RECOVERY_KEY set → existing verify_with_recovery_key path
     takes precedence, no new bootstrap

Run via:

    docker compose -f tests/e2e/matrix_xsign_bootstrap/docker-compose.yml up -d
    python tests/e2e/matrix_xsign_bootstrap/test_bootstrap.py
    docker compose -f tests/e2e/matrix_xsign_bootstrap/docker-compose.yml down -v

The test mirrors the bootstrap snippet from matrix.py inline so it can
run without importing the full hermes gateway and its deps. Skipped
automatically when mautrix isn't installed or the homeserver is
unreachable.

All three pass against ghcr.io/continuwuity/continuwuity:latest
(Continuwuity 0.5.7). The unpadded-keyid assertion is the load-bearing
one — it's exactly the property the PR's bootstrap path provides that
the hand-rolled `base64.b64encode().decode()` scripts get wrong.
This commit is contained in:
Andrew Miller 2026-04-23 23:18:51 -04:00 committed by Teknium
parent d497387cec
commit 6c70ac8eef
3 changed files with 403 additions and 0 deletions

View file

@ -0,0 +1,21 @@
services:
homeserver:
image: ghcr.io/continuwuity/continuwuity:latest
environment:
CONTINUWUITY_SERVER_NAME: localhost
CONTINUWUITY_DATABASE_PATH: /var/lib/conduwuit/conduwuit.db
CONTINUWUITY_PORT: "6167"
CONTINUWUITY_ADDRESS: "0.0.0.0"
CONTINUWUITY_ALLOW_REGISTRATION: "true"
CONTINUWUITY_REGISTRATION_TOKEN: testreg
CONTINUWUITY_ALLOW_FEDERATION: "false"
CONTINUWUITY_TRUSTED_SERVERS: "[]"
CONTINUWUITY_LOG: "warn,conduwuit=info"
CONTINUWUITY_ALLOW_CHECK_FOR_UPDATES: "false"
ports:
- "127.0.0.1:${HOMESERVER_HOST_PORT:-26167}:6167"
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/6167 && echo -e 'GET /_matrix/client/versions HTTP/1.0\\r\\n\\r\\n' >&3 && head -1 <&3 | grep -q '200 OK' || exit 1"]
interval: 2s
timeout: 3s
retries: 30