GRI-1912: approve route leaves the token for the device to collect #126
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!126
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GRI-1912-approve-leaves-token-to-device"
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?
Fixes #123 (second cause; PR #125 fixed a real but different problem).
Cause
POST /api/v1/devices/{id}/approve(devices/handlers.rs) calleddevices::issue_tokenitself and returned the token in the admin's HTTP response.issue_tokenis one-shot per row (token_hash IS NULL). So when the device then reconnected with its temporary id,ws.rshandle_temporary_reconnectfound the token already taken and answeredRejected: already enrolled on another connection— on every approval through the panel, not as a race. The client log in #123 matches: no connection ever loggedAccepted, because the token went to curl/the panel.The enrolment tests did not catch it because they approve with
devices::approve_pendingdirectly, not through the route.Change
plan/server/enrolment.md"On approval" says. Response is{"device": {...}},has_token: falseuntil the device reconnects.approving_a_pending_device_leaves_the_token_for_the_device: after the route,issue_tokenstill returns a token for the device.rest-api.md,deployment.mdand the panel's type comment updated. The panel never read the token, so nothing changes there.Checked here
cargo fmt --check,cargo clippy -p server --all-targets -D warnings, anddevices_integration+devices_acceptance_integration+enrolment_acceptance_integrationagainst local Postgres: 24 passed. Fulllocal-gates.shnot run; CI is the gate. End-to-end proof: the nextmvp-smoke-test.shrun (#115).