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.
This commit is contained in:
fl0l0u committed 2026-11-15 20:38:10 +00:00
1 parent 51e4c7f0f0
commit 1231eefbd3
2 files changed
+13 -2

No files matched your search

+3
View File
@@ -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<ModelCard> cards{ c };