diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-25 13:43:47 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-25 17:24:16 +0200 |
| commit | c6505677fd121265ab5cc52276ec9d0c1c73b6c9 (patch) | |
| tree | c5c6961b77424bab3168e331ca2769dcaeb89740 /packages/meshbay-node/tests/test_media_cache.py | |
| parent | 90c69477d5f701158112b3c294eff26312f89da6 (diff) | |
| download | meshbay-c6505677fd121265ab5cc52276ec9d0c1c73b6c9.tar.gz | |
fix(hub): refuse node-scoped tokens on the admin and moderator API
A node's authority and a hub role are different notions: what a node may do
is decided by its operator's roster pin on the node (NS4), while admin and
moderator are hub roles on a person's account, exercised from a browser with
a user-scoped token. The scope refusal was wired only onto require_user_scope
(group mutation), so require_admin and require_moderator accepted a
scope:"node" daemon token whenever the underlying account also held a hub
role. On a deployment where the operator is a hub admin and runs a node, the
daemon's in-memory token was therefore a full hub-admin credential — able to
revoke accounts and groups (signed, broadcast to every node), change instance
policy, and read the IP audit log.
Factor the refusal into _reject_node_scope(payload) and call it from
require_user_scope, require_moderator and require_admin alike, so a
node-scoped token is turned away with 403 on every privileged route.
test_node_scope_not_admin.py holds seven refusals, each asserting the same
account's user-scoped token still gets in; verified red against the pre-fix
deps.py and green after.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_media_cache.py')
0 files changed, 0 insertions, 0 deletions