@fuzdev/fuz_app 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -96,8 +96,8 @@ export interface RegisterActionWsResult {
|
|
|
96
96
|
* - Notifications (method + no id) are silently dropped per JSON-RPC spec.
|
|
97
97
|
* - Per-action auth: `public` / `authenticated` pass through (upgrade auth
|
|
98
98
|
* already verified identity); `keeper` requires `daemon_token` credential
|
|
99
|
-
* type *and* the keeper role; role-based `{role}`
|
|
100
|
-
*
|
|
99
|
+
* type *and* the keeper role; role-based `{role}` requires the named role
|
|
100
|
+
* via `has_role`, matching the HTTP path in `action_rpc.ts`.
|
|
101
101
|
* - DEV mode validates handler output against the spec's `output` schema and
|
|
102
102
|
* warns on mismatches.
|
|
103
103
|
*
|
|
@@ -42,8 +42,8 @@ import { BackendWebsocketTransport } from './transports_ws_backend.js';
|
|
|
42
42
|
* - Notifications (method + no id) are silently dropped per JSON-RPC spec.
|
|
43
43
|
* - Per-action auth: `public` / `authenticated` pass through (upgrade auth
|
|
44
44
|
* already verified identity); `keeper` requires `daemon_token` credential
|
|
45
|
-
* type *and* the keeper role; role-based `{role}`
|
|
46
|
-
*
|
|
45
|
+
* type *and* the keeper role; role-based `{role}` requires the named role
|
|
46
|
+
* via `has_role`, matching the HTTP path in `action_rpc.ts`.
|
|
47
47
|
* - DEV mode validates handler output against the spec's `output` schema and
|
|
48
48
|
* warns on mismatches.
|
|
49
49
|
*
|
|
@@ -118,8 +118,10 @@ export const register_action_ws = (options) => {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
else if (typeof auth === 'object' && auth !== null) {
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if (!has_role(request_context, auth.role)) {
|
|
122
|
+
ws.send(JSON.stringify(create_jsonrpc_error_response(id, jsonrpc_error_messages.forbidden(`requires role: ${auth.role}`))));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
123
125
|
}
|
|
124
126
|
// Look up handler — method is validated against spec_by_method above.
|
|
125
127
|
const handler = handlers[method];
|