From 1231eefbd33b2bbe9e0855f9ef0984f981667219 Mon Sep 17 00:00:00 2001 From: fl0l0u Date: Sun, 15 Nov 2026 17:21:09 +0000 Subject: [PATCH] server: the model card hides the expert-profile path keyless One member of the card's capabilities object -- expert_stats.file -- is a path on this machine, the --expert-stats file the engine reports. The card's `root` field already answers to the operator keyless and rides with the key to everyone else; this one member skipped that rule and leaked the deployment's file layout to any client that asked /v1/models. handle_models now strips expert_stats.file from the capabilities dump for a request that is neither keyless-local-operator nor api-keyed, matching `root` exactly. The rest of the object -- counts, tiers, the planner's shape -- is not a path and still ships. --- core/server/admin.cpp | 12 ++++++++++-- core/server/server.cpp | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/server/admin.cpp b/core/server/admin.cpp index 760a5969..ff9197e0 100644 --- a/core/server/admin.cpp +++ b/core/server/admin.cpp @@ -441,7 +441,7 @@ json Server::capabilities() const { * state, plus the engine's, pre-rendered because the server knows nothing about devices, * containers or placement (ServerOptions::engine_info). `endpoints` is the router's own table, so * it cannot go stale. */ -HttpResponse Server::handle_server_info(const HttpRequest&) { +HttpResponse Server::handle_server_info(const HttpRequest& req) { json srv; srv["model"] = opt_.model_id; srv["version"] = opt_.version; @@ -508,8 +508,16 @@ HttpResponse Server::handle_server_info(const HttpRequest&) { json e = json::parse(opt_.engine_info, nullptr, false); if (e.is_discarded() || !e.is_object()) RAD_WARN("server: engine_info is not a JSON object; /server_info omits it"); - else + else { + /* One member names a file on this machine -- expert_stats.file, the xstats output, + * the same path the model card strips for strangers (server.cpp). /server_info + * answers keyless by the dashboard-data posture, but a filesystem path is not + * dashboard data: a stranger gets the interval, never the path. */ + if (opt_.api_key.empty() && !local_operator(req) && e.contains("expert_stats") && + e["expert_stats"].is_object()) + e["expert_stats"].erase("file"); o["engine"] = std::move(e); + } } metrics_.observe_http(200); return HttpResponse::json_body(200, json_dump(o)); diff --git a/core/server/server.cpp b/core/server/server.cpp index 7157a0c6..44daa3b7 100644 --- a/core/server/server.cpp +++ b/core/server/server.cpp @@ -2316,6 +2316,9 @@ HttpResponse Server::handle_models(const HttpRequest& req) { * belongs to the operator alone, the rule /diagnostics and the LoRA admin follow; with a * key, everyone who can pay the key already owns this model's card. */ if (!opt_.api_key.empty() || local_operator(req)) c.root = opt_.model_path; + /* No capabilities member to strip here: capabilities() carries no expert_stats. The engine + * reports that path in its own info blob, and the splice at /server_info screens it for + * keyless strangers (admin.cpp, handle_server_info) -- the live guard, this is the map. */ c.capabilities = capabilities().dump(); metrics_.observe_http(200); std::vector cards{ c };