GRI-1856: independent acceptance tests for enrolment over WebSocket #102
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!102
Loading…
Reference in a new issue
No description provided.
Delete branch "test/GRI-1856-enrolment-acceptance-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Independent acceptance tests for device enrolment over WebSocket (GRI-1873, PR #94), not derived from the implementer's own
ws_integration.rs.Criterion-to-test mapping (
plan/tests/mvp-acceptance.mdsection 2; AC-2-01/AC-2-02 are E2E, out of scope here; AC-2-06 is already covered by the implementer'sa_known_device_with_a_valid_token_is_simply_accepted; AC-2-11/AC-2-12 are findings below, not tests):ac_2_03_a_rejected_pending_device_stays_unregisteredac_2_05_an_auto_approve_ip_registers_automatically_with_no_pending_stepac_2_07_a_registered_device_on_the_blocklist_is_dropped_when_the_setting_appliesac_2_08_a_registered_device_on_the_blocklist_is_admitted_when_the_setting_is_off(#[ignore]d — see finding below)ac_2_09_a_trusted_proxy_header_is_honoured_from_a_trusted_proxyac_2_10_a_forged_forwarded_for_header_is_rejected_from_an_untrusted_peerFail-first, verified by temporarily breaking each contract in the implementation and reverting (not committed):
Blockedbranch inhandle_temporary_reconnect→left: Pending, right: Rejected.AdmissionRules::decide→left: Pending, right: Accepted.blocklist_only_drop's check → the blocklisted peer was upgraded instead of refused.TrustedProxies::client_ipto always return the peer →left: Pending, right: Accepted.TrustedProxies::is_trustedto always returntrue→left: Accepted, right: Pending.All five pass cleanly against the real (unmodified) code:
Finding for the CTO, to route to the back-end engineer (not fixed here): AC-2-08 is genuinely broken.
ws::upgrade's pre-upgradeblocklist_only_dropcheck reads its rules fromdevices::load_admission_rules, which hardcodesblocklist_applies_to_registered: trueand never learns the server's actual configured setting — onlyhandle_socket, reached after the upgrade, overrides it fromEnrolmentState. So a blocklisted registered device is refused with a 403 at the upgrade stage before its token is ever read, regardless of whether the admin turned the setting off. Likely a one-line fix:upgrade()should applystate.blocklist_applies_to_registeredto the rules it loads, the same wayhandle_socketdoes, before callingblocklist_only_drop. Left#[ignore]d with that reason; un-ignoring it is the regression check once fixed.Findings, not tested (no design change needed to work around, but no current API surface to test against):
POST /devices/{id}/approveand friends are signage #13, not built), so there is nothing to assert "the panel still lists it" against. No time-based expiry code exists in the reconnect path either, so there's nothing a regression test could currently catch breaking.EnrolmentConfighas no cap field, and neitherdevices::create_pendingnorws::admitenforces one anywhere. This needs a design decision (where the cap lives, how it's configured) before a test can be written against it, not just a route../scripts/local-gates.sh: all gates passed.CI verdict:
fj ci