The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(dashboard): native-ticket callers clear route-local token checks
teknium131753a161189
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.pyindex 9003f981f21..b13a19b7aa2 100644--- a/hermes_cli/web_server.py+++ b/hermes_cli/web_server.py@@ -289,7 +289,12 @@ def _require_token(request: Request) -> None:``gated_auth_middleware`` already 401'd anything without a verified``request.state.session`` — requiring the absent token here would make every``_require_token`` endpoint unreachable behind the gate, so defer to it.+ A verified native owner (``authenticate_native_http``) is the same-user+ principal the outer seams already accepted; local Desktop runs with no+ static token, so that principal must satisfy route-local policy too."""+ if getattr(request.state, "native_http_principal", None):+ returnif getattr(request.app.state, "auth_required", False):ok = getattr(request.state, "session", None) is not Noneelse:diff --git a/tests/gateway/test_native_http_auth.py b/tests/gateway/test_native_http_auth.pyindex bf0fffba4b5..e142a7fc34e 100644--- a/tests/gateway/test_native_http_auth.py+++ b/tests/gateway/test_native_http_auth.py@@ -233,3 +233,20 @@ async def test_native_http_preserves_gated_auth_and_actual_socket_boundary(tmp_pclear_providers()print(json.dumps({'normal_oauth_bearer_cookie': 'passed','native_gated_auth_raw_peer_readiness': 'passed'}))++[email protected]_only+def test_native_http_principal_satisfies_route_local_token_policy(tmp_path):+ """Routes that call ``_require_token`` honor the verified native owner (F16).++ Local Desktop runs with authMode=native and no static token; the outer seam+ admitted the ticket, so the route-local check must not 401 the same request.+ """+ with daemon(tmp_path) as (home, descriptor), httpx.Client(+ base_url=descriptor['api_origin'], trust_env=False, timeout=30) as client:+ hub = client.get('/api/dashboard/plugins/hub', headers=headers(ticket(home, descriptor)))+ assert hub.status_code == 200, hub.text+ oauth = client.delete('/api/providers/oauth/__not_a_real_provider__',+ headers=headers(ticket(home, descriptor)))+ assert oauth.status_code == 400, oauth.text+ assert client.delete('/api/providers/oauth/__not_a_real_provider__').status_code == 401