feat(license): open the license FCs to any authenticated role, not just admin - #176
Merged
Merged
Conversation
…st admin The license function codes (0x48 anchor read, 0x49 blob write, 0x4A read back) were admin-gated in #169 on the theory that they were a trust boundary. That gate protected the wrong thing: the purchase is authorized by the Edge account on the /buy page, never by the runtime role, so requiring admin here only stopped an operator from activating a licence they had already paid for (hit in a live bench test 2026-08-25). What opens is low-risk: the anchor is the board's serial (baremetal exposes it with no auth at all), the blob is node-locked and useless on another device, and a bad write is recoverable (the entitlement lives in the backend; a refresh rewrites the correct blob). JWT re-verification still runs on every command, so "any role" means any logged-in user, never anonymous. - debug_websocket.py: drop the _current_user_is_admin gate on the license FCs, plus the now-dead helper and its current_user import. - test_debug_websocket_auth.py: the parametrized test now proves a user role runs 0x48/0x49/0x4A and that "Admin privileges required" never returns. Suite: 45 passed (restapi + plugins license tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015uUH3ZL5ehreMUf2dtanWD
thiagoralves
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Hit in a live bench test (2026-08-25): activating a purchased licence on a runtime-v4 device required an admin role. The license FCs (0x48 anchor read, 0x49 blob write, 0x4A read back) were admin-gated in #169 on the theory that they were a trust boundary.
That gate protected the wrong thing. The purchase is authorized by the Edge account on the
/buypage, never by the runtime role. So admin-gating the device-side FCs did not gate the money or the entitlement — it only stopped an operator from writing a licence they had already paid for. Runtime role and purchase authority are orthogonal.What
debug_websocket.py: drop the_current_user_is_admingate on the license FCs (plus the now-dead helper and itscurrent_userimport). JWT re-verification still runs on every command, so "any role" means any logged-in user, never anonymous.test_debug_websocket_auth.py: the parametrized test flips from "a non-admin cannot use the license FCs" to "auserrole can run 0x48/0x49/0x4A, andAdmin privileges requirednever returns". 0x48 is additionally asserted to hand theuserthe real anchor.What opens, and why it is low-risk
_reverify_session_token()still runs on every command.Proof
py_compileclean.tests/pytest/restapi/test_debug_websocket_auth.py+tests/pytest/plugins/test_vpp_license_debug.py). The 0x49 case shows the write is now reachable by auserand refuses an invalid blob on validation (status 0x83), not on role.🤖 Generated with Claude Code
https://claude.ai/code/session_015uUH3ZL5ehreMUf2dtanWD