Weights that run code are refused
CI / test (push) Successful in 8m57s

Python pickles (.bin, .pt, .pth, .ckpt, .pkl) run whatever they hold when
loaded, as the engine's user, on the node; that is how the malicious models
found on Hugging Face work. The node refuses such a source, or a mirror set
holding one, before fetching anything. A model added with one, or given
one, is refused, while one already in the catalog still loads and is
refused by its node with the same words. vLLM and SGLang downloading a
model by its id get --load-format safetensors. The mirror page marks the
file. allow_pickle: true on a model lets it through on purpose, carried to
the node in EngineProfile.allow_pickle.

BACKLOG M lists the rest: checksums against Hugging Face on every path,
its own scan, trusted publishers, engines without the internet, an eval
before an untrusted model serves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-25 23:17:22 +01:00
1 parent 6752938e6d
commit 4466d2d15a
31 files changed
+447 -44

No files matched your search

+17 -4
View File
@@ -323,9 +323,15 @@ type Model struct {
// choice by guesswork.
Description string `json:"description,omitempty" koanf:"description"`
// Source is the weights path or a HuggingFace id.
Source string `json:"source,omitempty" koanf:"source"`
Profiles []Profile `json:"profiles,omitempty" koanf:"profiles"`
Scaling Scaling `json:"scaling,omitempty" koanf:"scaling"`
Source string `json:"source,omitempty" koanf:"source"`
// AllowPickle lets the nodes fetch this model's weights, or its
// adapters', in a pickle format (.bin, .pt, .pth, .ckpt), which run code
// as they are loaded. Off, such a source is refused when the model is
// added and by the node before it fetches anything. For a model that has
// no safetensors or GGUF form and whose files were checked.
AllowPickle bool `json:"allow_pickle,omitempty" koanf:"allow_pickle"`
Profiles []Profile `json:"profiles,omitempty" koanf:"profiles"`
Scaling Scaling `json:"scaling,omitempty" koanf:"scaling"`
// Class is how much this model's capacity is worth against another's,
// when there is not enough for both: critical, standard or opportunistic.
// Empty is standard, or opportunistic for a model loaded on demand. See
@@ -1336,10 +1342,16 @@ func (m Model) EngineProfile(name string) (engines.Profile, bool) {
Name string `json:"name"`
Source string `json:"source"`
HFRepo string `json:"hf_repo,omitempty"`
// A string: the node reads the members as strings.
AllowPickle string `json:"allow_pickle,omitempty"`
}
var ms []member
for _, sm := range m.Shared.Members {
ms = append(ms, member{Name: sm.Name, Source: sm.Source, HFRepo: sm.HFRepo})
mb := member{Name: sm.Name, Source: sm.Source, HFRepo: sm.HFRepo}
if sm.AllowPickle {
mb.AllowPickle = "true"
}
ms = append(ms, mb)
}
b, _ := json.Marshal(ms)
env = maps.Clone(env)
@@ -1369,6 +1381,7 @@ func (m Model) EngineProfile(name string) (engines.Profile, bool) {
ServedModelName: m.Name,
Adapters: m.engineAdapters(),
KVEvents: p.KVEvents,
AllowPickle: m.AllowPickle,
}.WithRuntimeLoRA(m.MaxLoadedAdapters), true
}
return engines.Profile{}, false