GRI-1873: enrolment over WebSocket (signage #12) #94

Merged
vivy merged 7 commits from feature/GRI-1873-enrolment-websocket into dev 2026-11-10 02:56:32 +00:00
Member

Summary

  • Device WebSocket route (crates/server/src/ws.rs): the frozen handshake, the admission decision (blocklist / auto-approve / pending, per plan/server/enrolment.md), and the per-device token hand-off, per plan/shared/protocol.md.
  • The blocklist is checked against the bare peer address before the WebSocket upgrade is accepted, when it binds registered devices (the default): a blocked host gets a plain HTTP 403, no frames are ever parsed. When the operator turns that setting off, the check runs after ClientHello instead, since a valid token could exempt the address.
  • New modules: devices.rs (the device repository), tokens.rs (random token generation/hashing), signing.rs (a minimal ed25519 key load-or-generate for the signing_public_key the handshake hands a newly approved device — see ADR 0006; actual update signing/delivery stays "Later", per plan/shared/protocol.md).
  • New [enrolment] config section: trusted_proxies (addresses/CIDR ranges whose X-Forwarded-For is believed) and blocklist_applies_to_registered (on by default).

Scope note

This is signage #12 only. Admin auth and the devices/IP-rules REST API (signage #13) are the next PR — there is no POST /devices/{id}/approve route yet. devices::approve_pending is the function that route will call; ws_integration.rs exercises the approve → reconnect → token flow by calling it directly, the way a future REST handler will.

Test plan

  • cargo test -p server — unit tests, db_integration, http_integration, and new ws_integration (against a real Postgres via SIGNAGE_TEST_DATABASE_URL): all green.
  • New ws_integration.rs covers: an unknown device becomes pending and its Registration is recorded; approving a pending device then reconnecting with its temporary id issues a token; a blocklisted address is refused before the upgrade (plain HTTP 403); a device with a valid token is simply accepted.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo fmt --check: clean.
  • ./scripts/local-gates.sh --rust-only: every gate passed.
  • cargo deny check: bans/licenses/sources ok; the pre-existing advisories failure (unmaintained paste/proc-macro-error, via the client's optional gtk-renderer feature) reproduces identically on dev and is unrelated to this change.
## Summary - Device `WebSocket` route (`crates/server/src/ws.rs`): the frozen handshake, the admission decision (blocklist / auto-approve / pending, per `plan/server/enrolment.md`), and the per-device token hand-off, per `plan/shared/protocol.md`. - The blocklist is checked against the bare peer address **before the `WebSocket` upgrade is accepted**, when it binds registered devices (the default): a blocked host gets a plain HTTP `403`, no frames are ever parsed. When the operator turns that setting off, the check runs after `ClientHello` instead, since a valid token could exempt the address. - New modules: `devices.rs` (the device repository), `tokens.rs` (random token generation/hashing), `signing.rs` (a minimal ed25519 key load-or-generate for the `signing_public_key` the handshake hands a newly approved device — see ADR 0006; actual update signing/delivery stays "Later", per `plan/shared/protocol.md`). - New `[enrolment]` config section: `trusted_proxies` (addresses/CIDR ranges whose `X-Forwarded-For` is believed) and `blocklist_applies_to_registered` (on by default). ## Scope note This is signage #12 only. Admin auth and the devices/IP-rules REST API (signage #13) are the next PR — there is no `POST /devices/{id}/approve` route yet. `devices::approve_pending` is the function that route will call; `ws_integration.rs` exercises the approve → reconnect → token flow by calling it directly, the way a future REST handler will. ## Test plan - [x] `cargo test -p server` — unit tests, `db_integration`, `http_integration`, and new `ws_integration` (against a real Postgres via `SIGNAGE_TEST_DATABASE_URL`): all green. - [x] New `ws_integration.rs` covers: an unknown device becomes pending and its `Registration` is recorded; approving a pending device then reconnecting with its temporary id issues a token; a blocklisted address is refused before the upgrade (plain HTTP 403); a device with a valid token is simply accepted. - [x] `cargo clippy --workspace --all-targets -- -D warnings`: clean. - [x] `cargo fmt --check`: clean. - [x] `./scripts/local-gates.sh --rust-only`: every gate passed. - [x] `cargo deny check`: bans/licenses/sources ok; the pre-existing `advisories` failure (unmaintained `paste`/`proc-macro-error`, via the client's optional `gtk-renderer` feature) reproduces identically on `dev` and is unrelated to this change.
GRI-1873: enrolment over WebSocket (signage #12)
Some checks failed
CI / the pre-push hook (pull_request) Successful in 6s
CI / cargo fmt (pull_request) Successful in 17s
CI / cargo deny (pull_request) Successful in 1m5s
CI / cargo deny advisories (pull_request) Failing after 1m14s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 10m9s
CI / cargo test (pull_request) Successful in 10m25s
CI / frontend-web (pull_request) Successful in 10m20s
CI / CI (pull_request) Successful in 4s
CI / Notify gate failed (pull_request) Has been skipped
553cd9741a
Device WebSocket route: the frozen handshake, the admission decision
(blocklist / auto-approve / pending, per plan/server/enrolment.md), and
the per-device token hand-off. The blocklist is checked against the bare
peer address before the WebSocket upgrade is accepted when it binds
registered devices (the default), so a blocked host gets a plain HTTP 403
and no frames are ever parsed.

Adds the device repository (devices.rs), token generation/hashing
(tokens.rs), and a minimal ed25519 key load-or-generate (signing.rs) for
the signing_public_key field the handshake requires (ADR 0006); actual
update signing/delivery stays out of scope, per protocol.md.

Admin approval has no REST route yet (signage #13, the second PR); the
pending-to-approved transition is exercised directly against the device
repository in ws_integration.rs the way that route will call it.
GRI-1873: merge origin/dev (#93 login/sessions), wire both extension layers
Some checks failed
CI / cargo fmt (pull_request) Successful in 8s
CI / the pre-push hook (pull_request) Successful in 8s
CI / cargo deny (pull_request) Failing after 2m25s
CI / cargo deny advisories (pull_request) Failing after 2m26s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 10m28s
CI / cargo test (pull_request) Successful in 10m54s
CI / frontend-web (pull_request) Successful in 11m10s
CI / CI (pull_request) Failing after 4s
CI / Notify gate failed (pull_request) Successful in 4s
21487d9a1d
Merge remote-tracking branch 'origin/dev' into feature/GRI-1873-enrolment-websocket
Some checks failed
CI / the pre-push hook (pull_request) Successful in 5s
CI / cargo fmt (pull_request) Successful in 5s
CI / cargo deny (pull_request) Failing after 2m29s
CI / cargo deny advisories (pull_request) Failing after 2m3s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 10m18s
CI / cargo test (pull_request) Successful in 11m6s
CI / CI (pull_request) Has been cancelled
CI / Notify gate failed (pull_request) Has been cancelled
CI / frontend-web (pull_request) Has been cancelled
83d68560ef
# Conflicts:
#	crates/server/Cargo.toml
#	crates/server/src/http.rs
#	crates/server/src/lib.rs
#	crates/server/src/main.rs
GRI-1873: pin server's tokio-tungstenite dev-dependency to 0.28 (match client)
Some checks failed
CI / the pre-push hook (pull_request) Successful in 4s
CI / cargo fmt (pull_request) Successful in 4s
CI / cargo deny (pull_request) Successful in 52s
CI / cargo deny advisories (pull_request) Failing after 44s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo clippy (pull_request) Successful in 9m52s
CI / cargo test (pull_request) Successful in 10m29s
CI / frontend-web (pull_request) Successful in 9m46s
CI / CI (pull_request) Successful in 3s
CI / Notify gate failed (pull_request) Has been skipped
ff70a27b02
Merge origin/dev (#97 PDF) into feature/GRI-1873-enrolment-websocket
Some checks failed
CI / the pre-push hook (pull_request) Successful in 6s
CI / cargo fmt (pull_request) Successful in 6s
CI / cargo deny (pull_request) Successful in 48s
CI / cargo deny advisories (pull_request) Failing after 53s
CI / repository boundary (pull_request) Successful in 13s
CI / cargo clippy (pull_request) Successful in 10m7s
CI / cargo test (pull_request) Successful in 10m31s
CI / frontend-web (pull_request) Successful in 9m54s
CI / CI (pull_request) Successful in 4s
CI / Notify gate failed (pull_request) Has been skipped
af2318952a
GRI-1873: merge dev (playlists #99) into enrolment
Some checks failed
CI / the pre-push hook (pull_request) Successful in 15s
CI / cargo fmt (pull_request) Successful in 5s
CI / cargo test (pull_request) Has been cancelled
CI / cargo deny (pull_request) Has been cancelled
CI / cargo deny advisories (pull_request) Has been cancelled
CI / frontend-web (pull_request) Has been cancelled
CI / repository boundary (pull_request) Has been cancelled
CI / CI (pull_request) Has been cancelled
CI / Notify gate failed (pull_request) Has been cancelled
CI / cargo clippy (pull_request) Has been cancelled
10dd2445ca
GRI-1873: register ws connections in DeviceConnections on admission
Some checks failed
CI / the pre-push hook (pull_request) Successful in 13s
CI / cargo fmt (pull_request) Successful in 6s
CI / cargo deny (pull_request) Successful in 1m0s
CI / cargo deny advisories (pull_request) Failing after 1m21s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo clippy (pull_request) Successful in 10m7s
CI / cargo test (pull_request) Successful in 10m55s
CI / frontend-web (pull_request) Successful in 9m57s
CI / CI (pull_request) Successful in 4s
CI / Notify gate failed (pull_request) Has been skipped
59ab7e80e7
The device WebSocket handler now registers each Admission::Registered
device's sender in DeviceConnections and forwards pushed ServerControl
messages for the lifetime of the connection, unregistering on close.
Closes the gap connections.rs's own module doc called out: until now
playlists::handlers::assign_playlist's push always found nobody
listening.
vivy merged commit 879eda38b5 into dev 2026-11-10 02:56:32 +00:00
vivy deleted branch feature/GRI-1873-enrolment-websocket 2026-11-10 02:56:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!94
No description provided.