Repository navigation
Conversation
The model checks need one way to read a model file. Without it, each check opens files on its own, reads whole weights files and trusts the file name. The artifact package gives a part for each model file. A part has a kind, the format of its content, the format that its name claims and a template dialect. Its bytes load on demand through a Blob, and each read charges a budget of bytes and reads for the whole artifact. A read past the budget gives a BudgetError, so a check can say that it checked only part of the file. Classify reads the first 16 bytes. The content decides the format and the path decides the kind, because a model file can claim another format by its name. Range and Decoded give the parts that a part holds, so a child keeps the path of its file and names its place. Local opens one model file of a target root or a base commit. The git tree of the base gives no random access, so Local reads such a file whole up to 64 MiB and marks a larger one as unread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…nner The model checks of the next changes need one place to parse a part, one place to give the parts that a part holds, and one runner. Without them, two checks on one GGUF file parse its header twice, and each check finds the chat template in its own way. A view.View is one parsed view of a part. view.Session builds each view of a part once and shares it. A view is one sub-package with one Of accessor, so a new view changes no other file. The memo keys on the view value, so two views with one name stay apart. split.Expand gives the parts that a part holds, depth first and three levels deep. Each format family keeps its splitters in its own file, so the GGUF, template and torch changes touch different files. check.Check selects parts by kind, format and dialect, and returns signals. A signal holds evidence only: the part, the place, the visible text, a grade (runs-code, evasive or unknown) and a proof (structural, heuristic or metadata). The model control maps them to a severity and a confidence, so a check cannot set either. check.Run fills the check id, the technique, the part and the defaults. An unread file, an error, a panic, the budget or a cancel makes the result partly checked, never clean. Fingerprint folds the check versions into one value for a stored result. checktest runs one check on synthetic parts. checks.All joins one list for each check family, so two changes that add checks to different families touch different files. The glossary names the model artifact, the part, the split, the model view, the model check and the model signal, and qualifies the words that they overload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The model checks need a family, a manifest kind and a control that turns their signals into findings. Without them, a signal has no severity, no finding id and no place in a report. The model family holds the attacks in a model file. The family enum and the manifest kind enum of the report are closed, so the schemas change. The model manifest kind is one model file of the target. A file manifest does not fit, because it means a file with a sign of hidden code. The model control runs the checks of checks.All on the file of a model manifest, with a read budget of 256 MiB and 65,536 reads. Each check is one control id. The control maps the grade of a signal to the severity (runs-code critical, evasive high, unknown medium) and the proof to the confidence (structural high, heuristic medium, metadata low), so a check cannot set either. Each model control warns. The engine sets the attack flag from the control info, and a control id names its technique only when it is an attack control. The finding has a file subject, as hidden-code does. The part and the key of the signal go in the discriminator and in the evidence, so each part of a file gets its own finding id. The control writes the visible text and the title in ASCII, with each other character as an escape and each URL defanged as hxxps[:]//x[.]example. The form [:]// keeps "://" out of the text, so the markdown formats add no zero-width space. A file that vet checks only in part gives model-partly-checked and a diagnostic, never a clean result. In pull request mode the control also checks the base version of the file and reports only the signals that the base did not have. New rejects a check with no id, title, description, remediation, grade or Run, and two checks with one id. A test registers a check in the test only and pins the finding of a synthetic GGUF file. The sink goldens show one model finding in each format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
… apart The model checks read hostile files. A later change could make a view fetch bytes, make a check open a file past the read budget, make a check build its own finding with the attack flag, or render a chat template. Each of these joins layers that the design keeps apart. The archtests now fail when a package under modelfile imports net, os/exec, plugin, finding, the vet plugin API, a control, an enricher or internal/modelhub, or depends on os/exec or a template runner through a library. Only the artifact package of modelfile imports os or io/fs. No vet package imports text/template or html/template. The model control imports only artifact, check, checks and the view session of modelfile, and no control imports net/http, grpc or internal/modelhub. A test of the checks package keeps one check in each file. Each rule failed on a probe import, checked once by hand. AGENTS.md lists the rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A model check needs the globals that a pickle stream imports and the calls that it makes, with their offsets. A scanner that unpickles runs the payload, and gopickle allocates the length that a stream claims. The pickle view reads every opcode of protocols 0 to 5 and simulates the stack, the mark stack and the memo as CPython does. It records each global from GLOBAL, STACK_GLOBAL, INST and EXT1 to EXT4, and each call from REDUCE, NEWOBJ, NEWOBJ_EX, INST, OBJ and BUILD, with the callee or the root global, the argument globals, the string arguments and a dynamic flag. APPEND and SETITEM on an object that is not a container count as calls. A STACK_GLOBAL with operands that are not constants and an extension code are dynamic. Protocols 0 to 2 get the fix_imports mapping, so __builtin__ reads as builtins. A stream that does not end at STOP keeps the records before the break. The view reads consecutive streams and reports the trailing bytes. A legacy torch.save file is five streams and then raw storage bytes, so the view stops after the fifth stream. The bytes argument of a known loader, such as pickle.loads or torch.storage._load_from_bytes, is a nested stream. After the BUILD of a joblib NumpyArrayWrapper the view skips the inline array, or reads the pickle of an object array, so the calls after the array stay visible. The view reads through a buffer of 64 KiB on the part, so each window is one read of the budget. It never allocates a claimed length: a literal over 1 MiB, or over the 64 MiB that one analysis holds, stays in the file by its offset. Limits cap the opcodes, the values, the nesting depth, the streams and the distinct records. Calls of one shape are one record with a count, so a torch file with a thousand tensors keeps a few records. A budget error stays in the error of the stream. Tests cover each opcode path of the lab cases, the 14-byte BINBYTES8 that claims 16 GiB (it allocates under 1 MiB), a skipped literal of 8 MiB, the budget error and the limits. A fuzz test checks the memory of each input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…f it The model checks had no reader for a GGUF file, so a chat template in its metadata and the bytes after its tensor data stayed out of reach. The gguf view reads the header through the read budget and never the tensor data. It takes versions 2 and 3 only. It checks each length against the bytes that the file has left before it allocates or skips, so a short file with a large length field costs nothing. It stops with a view.FormatError on a broken header, and marks the error as Limit when a field is over a reference limit of vet: 65,536 keys, 2^20 tensors, keys of 64 KiB, strings of 64 MiB, arrays of 2^24 items, an alignment of 1 MiB. It rejects an unknown value type, a nested array, a bool above 1, an alignment that is not a power of two, a tensor of an unknown ggml type or with a row that is not a whole number of blocks, and tensor data past the end of the file. It gives the data start and end from the ggml block-size table, the region after the padded data, the gaps that the alignment does not need, the overlaps, the unaligned tensors, and the keys and tensor names that the header holds twice. A budget error stays a budget error, so a check reports "partly checked", not "malformed". The gguf-chat-template splitter gives tokenizer.chat_template and each tokenizer.chat_template.<name> as a byte range of the file, so a signal offset maps back into the file. view.FormatError and view.Region are shared by the views. viewtest holds a blob helper and a memory cap for the fuzz tests: a parse of n bytes must allocate at most 2 MiB plus 64 bytes for each byte. The fuzz test ran 1.2 million inputs in 60 s with no failure. checktest.GGUF builds the synthetic files. The check and control tests used "GGUF evil" as a GGUF file. The real splitter now reports that file as broken, so the check tests use a text file and the control tests use a real synthetic GGUF file. The finding golden does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A pickle stream hides in a container: a member of a torch zip or an npz, the object array of a NumPy file, or a zlib, gzip or bzip2 wrapper of joblib. A scanner that reads a zip in another way than torch does misses the payload, as the CVEs of picklescan show. The container view reads a zip from its central directory by range reads, never the weights. It compares the central directory with each local header that it reads and reports a different name (CVE-2025-1944) or method, the encryption flag (CVE-2025-1945), other flag differences, a CRC error (CVE-2025-10156), duplicate names and bytes before the archive. It finds a zip from its end record when the file does not start with a local header, as Python's zipfile does. It sniffs 4 KiB of each member that torch.load does not read as raw bytes, so a hidden member (CVE-2025-1889) counts by its content. A member that starts with a protocol 0 or 1 opcode counts only with a pickle name, because those opcodes are also first letters of text. An npz of float arrays costs one sniff for each member. The view decodes zlib, gzip, bzip2 and deflate with the standard library to at most 128 MiB, and keeps the decoded start of a stream that breaks. It finds 7z, xz and lzma by their magic and does not unpack them. No dependency is new. A member or a wrapper that vet could not read is a problem of the archive. The torch splitter gives a part for each stream: a byte range of the file for a stored member, or the decoded bytes of a compressed one. A problem is a split error, so the scan is partly checked. The artifact package now knows the NumPy magic and the .npy and .npz names. Tests cover each differential, the members, the wrappers, the cost of an npz and the split of a zip in a zlib wrapper. A fuzz test checks the memory of each input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…ate lowering The template checks need to read a chat template without a render. A renderer of a hostile template can run code, and gonja parsed only 74% of the real templates of the research corpus. view/tmpl holds one AST for both dialects. ParseJinja is the parser of the research lab: a tag splitter that skips strings, drops comments and keeps raw blocks, Python string escapes, and a precedence parser that takes conditionals anywhere, trailing commas, slices, keyword arguments, * and **, "is [not] test arg" and adjacent strings. A tag that it does not know parses as a statement, or as a block when it has an end tag. The port merges the lab parser and the SDK prototype into one implementation. It also fixes two loops that did not end at the end of a macro parameter list or a call block parameter list, and a slice out of range in a raw block. It limits the nesting to 128 levels and an operator chain to 4,096 items, so a hostile template cannot recurse deep in the parser or in a check. ParseGo lowers a Go template, the form of Ollama, with text/template/parse and SkipFuncCheck, which parses and never runs it. A field becomes a lower case attribute, so .Content and m.content give the same facts. A test pins the facts of four pairs of templates. Template.Facts gives, once for each template: the fragments of fixed text that can reach the prompt with the conditions around each one (it follows set variables, namespace fields and macro call sites, joins constant concatenations, and drops the text of raise_exception), the constant that a condition compares message text with (ContentLiterals), and whether a condition reads message text, a variable set from it, the clock or a flag set under a condition on message text (ReadsData). Fold gives the value of a constant expression, with a cap of 64 KiB, and walks a long concatenation in a loop. Normalize and Fingerprint give the key of a list of known templates. A template that does not parse gives a SyntaxError. The tokenizer-chat-template splitter gives the chat_template field of tokenizer_config.json and chat_template.json, as a string or as each template of a named list. A chat_template.jinja file is a chat template part already. Measured with VET_MODEL_TEMPLATE_CORPUS on the research corpus, which vet does not commit: 741 of 741 tuning templates and 983 of 983 holdout templates parse (the 897 holdout repositories that are not in the tuning set included). 741 of 741 tuning templates and 86 of 86 holdout templates with a recorded jinja2 shape match it on constants, filters, tests, attributes, loops, conditions and macros. 7 of 7 Ollama templates parse. The fuzz test ran both parsers and the facts on 1.46 million inputs in 90 s under a cap of 512 bytes of allocation for each input byte. It found the raw block fault, and its input stays in testdata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The model checks had no reader for a safetensors file, so the bytes that no tensor covers and a header built to break a loader stayed out of reach. A polyglot file hides a payload in such bytes: the safetensors library rejects it, and a loader that reads only the offsets of the header takes it. The safetensors view reads the 8-byte length and the JSON header through the read budget, never the tensor data. A length over 100,000,000 bytes, the limit of the safetensors library, is a FormatError with Limit set. A length past the end of the file is a FormatError, and the view never allocates it. The header must be one JSON object with nothing after it. The view reads its keys in order, so a key that the header holds twice stays visible: encoding/json and the Python parser keep the last value, and another parser can keep the first. Each tensor needs a known dtype, two data offsets in order, and a data size that matches its shape. __metadata__ must be a map of strings, and the view gives its size and values. The view gives the tensors in the order of their data, the gaps between them, the overlaps, and the region after the last tensor. The fuzz test ran 1.58 million inputs in 60 s under a cap of 64 bytes of allocation for each input byte. checktest.Safetensors builds the synthetic files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The pickle and container views give evidence, but nothing grades it. A model file that runs code on load gave no finding. unsafe-pickle grades each pickle stream in three grades. A global on the exact allowlist gives no signal, and the allowlist never matches a prefix. A class under torch.nn.modules., sklearn., ultralytics.nn. or omegaconf., and argparse.Namespace, give no signal. A function under those prefixes does not match, because a framework has loaders. A getattr with one constant name that is not private, on a global that is not strong, is a method reference and gives unknown. The strong set, a global built at load time, and a call of a fetched attribute give runs-code. A dotted name with a dunder or a strong module in it is strong, because protocol 4 walks it. A stream that breaks after a call that runs code gives evasive. A stream that breaks with no such call gives unknown, and a budget error leaves the file partly checked. The globals that vet does not know give one unknown signal for each stream. Nested streams count with the offset of the loader call. The allowlist, the framework prefixes, the strong set, the picklescan denylist and the conditional globals are data in pickle_globals.go: 96 allowed globals, 4 framework prefixes and 1 framework class, 45 strong modules, 35 strong names and 78 denylist entries in 56 modules. pickleGlobalsVersion folds into the version of the check. Next to the lab lists, the allowlist holds numpy.float64, scipy.sparse._csr.csr_matrix, typing.Any, torch.torch_version.TorchVersion and the three NumPy random constructors, which real sklearn and torch files use. A framework class name can start with underscores, as sklearn's _BinMapper does. The zip differentials and the 7z, xz and lzma wrappers are a check of their own, evasive-model-archive. They show a file built to evade a scanner even when each pickle in it is clean. They have another remediation, and FOU-718 can promote them apart from the pickle grades: the lab rules gave no false positive on 132 real zips. The unsafe-pickle check skips a part that holds a wrapper or a zip, which the split reads. Each control warns. The model control maps runs-code to critical, evasive to high and unknown to medium, structural proof to high confidence and heuristic proof to medium. A control test runs the built-in checks end to end. Near misses with the globals of gpt2, opt-125m, ultralytics, sklearn and fairseq give no signal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The grades of unsafe-pickle and evasive-model-archive need a record against the attacks that the lab built, and against real files. The 53 lab cases are testdata, with one table row each: the signals of both checks, and whether the scan is partly checked. The lab script wrote them from opcodes and never unpickled them. A second test checks each row against the grade of the lab. Measured on the 53 cases, with the views, the split and both checks: - 42 of 42 malicious cases give runs-code or evasive. 39 give runs-code. joblib_lzma, joblib_xz and real_7z give evasive only, because vet does not unpack lzma, xz and 7z. Each of the three is also partly checked. - 8 of 8 benign cases give no signal and are not partly checked. - Of the 3 unknown cases, getattr_method_ref and bomb_binbytes8 give unknown. model_7z gives evasive, because the brief grades a 7z wrapper as built to evade. The lab graded it unknown. Measured on the lab corpus (pickle/corpus/results.jsonl, 168 real files with pickle members). The corpus holds the globals of each stream, not the bytes, so a test outside the tree rebuilt each stream from its imports, its call counts and the method references and indirect calls that the lab recorded, and ran the grader on it: - 156 give no signal, 12 give unknown, 0 give runs-code or evasive. - The lab got 166 and 2. The 2 __main__ references are unknown here too. 2 files with a getattr method reference (Bingsu/adetailer, kurianbenoy/kde_en_ml_translation_model) are unknown, because the brief grades a method reference as unknown. 8 files use classes of frameworks outside the prefix list: pyannote, flair, pytorch_lightning, rdkit, tokenizers, imodels with pandas, dill _load_type, and a Cython unpickle function of sklearn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A model can carry a chat template that adds text the user does not see: a command for an agent, a link, an order to the model, or text that a phrase arms (Malspark, Pillar). vet had no check for it. poisoned-chat-template runs the six rules of the research lab on each chat template part (GGUF metadata, tokenizer_config.json, chat_template.json, chat_template.jinja, a Go template): - ssti: a path to Python internals. Jinja only. Grade runs-code, proof structural. - shell: a shell or PowerShell command shape, on the joined strings. - url: a link to a host other than huggingface.co, hf.co, github.com and arxiv.org. - trigger: a condition on message text against a phrase of words, whose branch adds 3 or more words. - directive: an order to the model in a sentence that the benign templates do not hold. - tool-call: a literal tool call that is not a placeholder. The last five give grade evasive with a heuristic proof. A template that does not parse leaves the file partly checked. chat-template-review gives a medium finding for prose that the benign templates do not hold under a condition on message text, a variable set from it, the clock, or a flag set under a condition on message text. It also reports a template that does not parse. It catches the evasions that pass the six rules. The rare-sentence test of the lab reads the benign corpus, and vet cannot ship the corpus. vet ships known_sentences.txt: the 163 normalized sentences that 2 or more distinct tuning templates hold, as the first 8 bytes of their sha256. A hash holds no text of a template. It is the lab test on the holdout exactly, and TestTemplateCorpus rewrites and checks the file from the corpus. Each signal names the rule and the matched text in its key, has the offset and the line in the template, and shows the line around the match. Both controls warn. The technique id is poisoned-chat-template (ATLAS AML.T0018.003 and AML.T0051, ATT&CK T1204.002). Measured with VET_MODEL_TEMPLATE_CORPUS on the research corpus, which vet does not commit (lab numbers in brackets): poisoned-chat-template, tuning, leave one out 1 of 741 [1 of 741] poisoned-chat-template, tuning, shipped list 1 of 741 poisoned-chat-template, holdout, shipped list 4 of 897 [4 of 897] chat-template-review, tuning 5 of 741 [6 of 741] chat-template-review, holdout 7 of 897 [8 of 897] The flagged benign templates are the ones of the lab: a literal call of execute_bash (Ripple, 2 repositories), of direct-injected-document (North-Mini-Code, 2 repositories), and "never reveal" in Olala. The review check flags one template fewer in each set. The port folds join and string without lower case, so a few sentences of the index differ. Detection matrix of the synthetic templates (P poisoned, R review): M01-M03 timdedid shell url trigger directive P R M04-M06 mir2k shell directive P M07-M08 pillar url trigger P R M09 hunter2 trigger P R M10-M14 ssti ssti P M15 forged call shell url tool-call P M16 curl | sh shell url P M17 exfil link url P M18 length directive P M19 macro trigger directive P R M20 tool desc shell url P GM01, GM02 (Go) GM01 as M01, GM02 trigger P R N01-N10, GN01 none - X01, X03, X04 none R X02 paraphrase trigger P R 20 of 20 attacks and both Go attacks, 0 of 11 near misses. The 37 templates are table cases in testdata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A model file can carry bytes that its loader ignores, or be built so that two loaders read it in two ways. A scanner that reads only what the loader reads misses the payload, and vet had no check for either. model-payload-carrier reports, for each region it finds, the size, the offset, what the first bytes are and the sha256 of the region (up to 16 MiB), never the bytes: - the bytes after the padded GGUF tensor data, and after the last safetensors tensor - the bytes between GGUF tensors past what the alignment needs, and the gaps between safetensors tensors - a GGUF or safetensors file with no tensors, or of less than 1 KiB, as the safetensors decoy of 42 bytes of the Pluto campaign - a content format that does not match the file name, such as GGUF content with a safetensors name. A torch name takes zip and pickle, and a pickle name takes the gzip, bzip2 and zip of joblib and pandas. - a 7z or an xz wrapper with any name. vet does not unpack it. The first bytes of a region set the grade: an executable (MZ, ELF, Mach-O, #!) runs code, another file format (zip, 7z, xz, gzip, bzip2, pickle, GGUF, safetensors) is evasive, and other bytes are unknown. A name that the content does not match, and a wrapper, are evasive. malformed-model-file reports a header that breaks its format (unknown, as a broken download can do it) or a limit of vet (evasive), a key or a tensor name that the header holds twice (evasive), tensors that overlap (evasive), and tensors that are not aligned (unknown). A budget error is not a broken file: the file is partly checked. Each proof is structural. Both controls warn, with the technique ids model-payload-carrier (ATT&CK T1027.009) and malformed-model-file. The table tests cover an MZ, ELF, PK and unknown tail, a large gap, the near misses of a GGUF file with its normal alignment padding and of a safetensors file whose offsets cover it exactly, and each layout fault. A control test runs the built-in checks on one GGUF file and pins the severity and the confidence of each finding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The glossary had no term for the parsed chat template, its fragments, or a part whose bytes break its format. The template checks and the structure checks use these terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…ning-local The merge keeps both sides of docs/controls.md and docs/glossary.md, and fixes two problems between the template track and the pickle track. Each wrapper signal has one owner now. The evasive-model-archive check reports the archive and wrapper evasion: the zip differentials and the 7z, xz and lzma wrappers. The model-payload-carrier check had its own path for a 7z or xz wrapper, so a 7z file gave two findings. That path is gone. model-payload-carrier keeps the bytes after the declared data, a weights file with no tensors or below the minimum size, and a content magic that does not match the file name for a format that is not a wrapper. The tests that ran the split on fake bytes now use real files. The GGUF case of TestEvasiveModelArchive uses a checktest.GGUF file, and the torch zip and the gzip pickle cases of TestModelPayloadCarrier use a real zip and a real gzip stream. The split of the pickle track read the fake bytes and left the file partly checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
joblib writes the xz and lzma wrappers itself, so a joblib file in one of them is a normal file. The evasive-model-archive check gave it the grade evasive and a high finding. Now the check grades only a 7z wrapper evasive, because no torch or joblib writer makes one. A file in an xz or lzma wrapper gives only the model-partly-checked finding, because the container view does not unpack the wrapper. The two lab cases joblib_xz.joblib and joblib_lzma.joblib now give no signal and are partly checked. TestPickleLabGrades takes a partly checked file as not clean, and 40 of the 42 unsafe lab cases get a grade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The model control gave each unknown grade a medium finding. On 168 real pickle files, 12 got the unknown grade from globals of libraries such as pyannote, flair, pytorch_lightning, tokenizers and rdkit. At medium these findings are too noisy and hide the pickles that run code. The control now sets the severity from the check and the grade. An unknown signal of unsafe-pickle is low. An unknown signal of another check, such as chat-template-review or model-partly-checked, stays medium. docs/controls.md gets a Model files section with the severity and confidence table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The testdata held the official chat templates of Llama 3.1 and Llama 3.2 as near misses, and M08 started from the Llama 3.2 template. The Llama Community License does not let vet commit them under Apache-2.0, and the Gemma Terms of Use do not either. N02 and N03 are gone. M08 is now a short template that vet wrote in the Llama 3 token format, and it gives the same rules: url and trigger. TestLicensedNearMisses runs both template checks on the Llama 3.1, Llama 3.2 and Gemma templates of the research corpus when VET_MODEL_TEMPLATE_CORPUS is set. On the lab corpus it reads 24 Llama and 126 Gemma templates, and no rule fires. testdata/README.md names each file, its source and its licence. Each template that remains starts from the Apache-2.0 template of Qwen3 or is written for vet. The earlier commit of the template track still holds the removed text in the history of this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Part.Range set the offset of a child relative to its parent. A range of a range, such as a pickle member of a zip that is itself a member, then had an offset that no reader of the file can find. The finding named an offset of the part, not of the file. Range now adds the offset of its parent, so Origin.Offset counts from the start of the root file at any depth. A range of decoded bytes has the offset -1. Part.FileOffset maps an offset of the part into the file, and the check runner sets Signal.FileOffset from it. The model control names that offset in the evidence. TestRangeOfARange covers two levels, and TestEvidenceNamesTheOffsetInTheFile covers a chat template in the GGUF metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
vet had the model checks and the model control, but no extractor gave a model manifest, so a scan of a repository checked no model file. The model/file extractor in internal/plugins/extractors/modelfile gives a model manifest for each model file: by its name (GGUF, safetensors, torch, pickle, joblib, NumPy, tokenizer_config.json and the chat template files), and by its first bytes for a renamed GGUF file or pickle with no extension or a .dat, .data, .model or .weights extension. A .bin file needs the magic of a model format, because many tools write .bin files. The extractor reads 64 bytes of a file. It skips a Git LFS pointer, so a checkout with no LFS gives no false malformed finding. docs/controls.md says that vet checks no model bytes for a pointer. The manifest kind model is file-only, so the extractor runs for each package selection. The walk of the engine applies --exclude and does not follow a link out of the target. The model control reads only the headers: a sparse GGUF file of 5 GiB costs 262194 bytes of reads (TestLargeFileReadsOnlyTheHeader). In pull request mode, gitbase.SameBlob read the whole head file into memory to compare it with its base blob. It now hashes the file as a stream, so a large model file does not go into memory. The acceptance scripts scan/models/repository and scan/models/pr-change run the real binary. The first scans a poisoned GGUF header, an unsafe pickle and a clean safetensors header, and the attacks gate passes. The second arms a chat template in a change and gets only the new signal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The SSTI rule read folded strings, but the shell, URL, directive and
trigger rules did not. The fragment emitter gave the base literal of a
replace or reverse filter, and eachString gave only the literals of the
AST. A template such as "httpX//evil.example/a.sh"|replace("X","://")
printed a link, but each rule saw only "httpX//evil.example/a.sh". The
check graded the template clean.
The emitter now gives the folded value of a filter, a call or an
operator when its inputs are constant, and eachString also gives the
folded value of each such expression of the AST. Each rule now reads the
text that the renderer prints. Fold moves to fold.go and learns more of
what the renderer does: join with a separator, the join method with its
separator, the format filter and the % operator with %s, %d, %i and %v,
the format method with {}, {0} and {name}, and the printf of a Go
template. Before, format returned its base string and join dropped its
separator.
The replace case gives "http:////evil.example". A URL parser of a
browser or of curl skips the extra slashes, so hostRe now skips each
slash and backslash after the scheme.
TestRulesReadFoldedStrings has a hit for replace, reverse, two replaces,
format, the format method, %, a concatenation under a filter, join, a
set that an output prints, and printf, and two near misses. Each hit
failed on the old code.
The corpus run (VET_MODEL_TEMPLATE_CORPUS, TestTemplateCorpus) gives
the same counts as before. poisoned-chat-template flags 1 of 741
tuning repositories (leave one out and the shipped list) and 4 of 897
held-out repositories. chat-template-review flags 5 and 7.
known_sentences.txt does not change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The container view sniffed a tar archive, but parse had no tar case and no default. A .pt file in the tar format of torch.save gave no member and no problem. unsafe-pickle then skipped the part as a container, so a tar file with os.system in its pickle member graded clean. torch.load still reads this format. The view now reads a tar with archive/tar from the standard library. It gives each regular member that starts a pickle stream: sys_info, pickle, storages and tensors. storages and tensors start with a pickle of a count, and torch.load unpickles it, so a payload there also runs. The tar reader seeks over the data of each member, so the raw storage bytes cost no read. A cut archive or more than 1024 members is a problem. parse now has a default case. A format that the view sniffs and does not read is a problem, so the file is partly checked and never a clean pickle. FormatZlib, FormatLZMA and FormatTar move from the container view into artifact, so Format is one closed set. Archive.Container replaces the format test in unsafe-pickle. TestUnsafePickleOfALegacyTorchTar has a payload in the pickle member, a payload in the count of the storages, and a clean file. The two payloads graded clean on the old code. TestUnreadContainerIsAProblem failed on the old code too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
ChatTemplates gave only the tokenizer.chat_template keys of the string type. A key of another type, such as an array of strings, was skipped with no signal and no diagnostic. No check read it, and the file passed as clean. A loader that joins the array, or that reads the key in its own way, then renders a template that vet never saw. The GGUF view now gives MistypedTemplates, and malformed-model-file reports each such key with the key template-type:<key>, the type of the value and its offset. No GGUF writer stores a chat template as another type, so the signal is evasive with a structural proof, as a duplicate key is. The check version goes to 2. TestMalformedModelFile has a template as an array, a named template as a number, and a near miss with a key that only starts like a template key. The first two failed on the old code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
where() named the offset of a signal only when it was over 0. A signal at the first byte of a file, such as a protocol 0 pickle whose first opcode imports os.system, gave evidence with no offset. A reader could not tell it from a signal on the whole file. At now has a HasOffset flag. A check sets it with the offset, and the runner maps the offset into the file only when it is set. FileOffset is -1 for a signal with no offset. where() names the offset when the flag is set, also when it is 0. TestEvidenceNamesOffsetZero runs the built-in checks on such a pickle and failed on the old code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
check held the authoring surface of a check and also the runner: Run, Result and safeRun. The runner imported split, so check depended on every splitter and view. Run also took no splitters, so checktest could not run a check with its own splitters, and a new splitter in P0b would change the check package. scan.Run(ctx, session, artifact, splitters, checks) now runs the checks. check keeps Check, Input, Signal, Grade, Proof and the helpers, and no longer imports split. checktest.Run passes split.All. The runner tests move to scan_test.go with no change. The control now imports scan and split. The archtest allow list of the control grows by both until the control calls a scan entry point that picks the splitters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The model control opened the file with artifact.Local, built the session and the budget, and picked the splitters. A change to how vet reads a file then changed the control, and the archtest had to let the control import artifact, view and split. scan.File(ctx, fsys, path, limits, checks) now opens the file, runs the built-in splitters and the checks, and closes the file. The read budget moves to scan.DefaultLimits. The control keeps only the map from signal to finding, the severity tables and the base compare. The control still gives the checks, because its control ids come from them, and a test of the control registers a check of its own. The archtest allow list of the control shrinks to check, checks and scan. scan may import io/fs, because it gives the file system only to artifact.Local. TestLargeFileReadsOnlyTheHeader moves to the scan package, which now owns the read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A signal named its part with a flat Part string, the Ref of the part. The control and a P0b hub check could not tell the path from the place in the file without parsing that string, and a signal had no structured way to say that it is on the whole file. Signal now has Origin artifact.Origin. The runner sets it from the part of a PerPart check. Origin.Ref gives the "path#element" name, and Signal.Ref and Part.Ref use it, so a report and a finding key read the same text as before. The control tests Origin.Element to find a signal on the whole file, and no longer compares the part with the path. The finding ids do not change. The golden testdata/finding.json pins the id of a finding on a whole file. TestEvidenceNamesTheOffsetInTheFile now pins f-b04dc8c367c5322a, the id that the old code gives a finding on the chat template in the GGUF metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The runner gave a signal with no grade the grade of its check, which is the strongest grade that the check gives. A check that forgot to set a grade then gave a critical finding. poisoned-chat-template worked around it: it set evasive on each signal with no grade, so the default of the runner never applied there. A check could also give a grade stronger than its own, and its control id then gave a finding over its documented severity. Info.Grade is now Info.MaxGrade. The runner turns a signal with no grade, or a grade over MaxGrade, into an error, so the file is partly checked and the signal gives no finding. Grade.Within compares two grades. Each template rule now sets its grade: ssti runs-code, the other rules of poisoned-chat-template evasive, and the review rule unknown. The workaround is gone. TestRunRejectsABadGrade failed on the old code, which gave both signals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The description of unsafe-pickle said that an unknown global gives a finding of low severity. A check sets no severity, so a change to the severity table of the control left the text of the check wrong. The control also held the one exception in lowUnknown, a set of check ids with no link to the grade that it changed. The check description now names no severity. The control has one table of the severity for each grade, and checkSeverity, a map from check id to grade to severity, for the exceptions. TestCheckSeverityNamesRealChecks fails when a key is not a check of checks.All, or when a grade is over the max grade of its check, so a renamed check cannot lose its override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The archtests kept the network, os/exec and the controls out of the model check SDK, but no test kept the packages of the SDK in order. A view could import another view, a check could import split or the runner, and nothing failed. P0b adds splitters and a scan entry point for hub files, and such an import would make that work change a check or a view. TestModelfileLayers now checks the imports from modelfile of each layer. artifact imports no other modelfile package. view and each view sub-package import only artifact and view. split imports no check, checks or scan. check imports no split, scan or checks. checks imports no split or scan. The control rule that allows only check, checks and scan stays in TestControlsReadNoNetwork. A rule that adds view/gguf to the deny list of checks made the test fail, so the test reads the real imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bea0c5d4db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The container view read a zip member with a pickle name, such as
archive/data.pkl, only when Sniff gave the pickle format. Sniff knows only
the first opcodes "(", "c", "]", "}" and the protocol 2 magic. A stream
that starts with another opcode, such as NONE then POP before the
payload, was skipped with no signal and no diagnostic. The legacy torch
tar path had the same gap for its pickle, storages, tensors and sys_info
members.
The loader reads such a member by its name, whatever its first opcode.
Now the view takes a member with a pickle name, or a torch tar member
name, as a pickle stream whatever its first opcode. The NumPy case stays
first. A member with no name claim still needs the protocol 2 magic,
because protocol 0 and 1 opcodes are also common first letters of text.
unsafe-pickle gives more signals on such files, so its version goes to 3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The container view took a structured dtype as one with an object field
only when the header held the text 'O. NumPy writes the object code with
its byte-order prefix, as in [('payload', '|O')], so the view skipped the
pickle stream of such an array. A hand-built file can also write '<O',
'>O', '=O', a width such as 'O8', a subarray such as '(2,)O', double
quotes, or the name object. The test also read the payload of a field
whose name starts with O, such as 'Output', and then graded raw float
bytes as a broken pickle.
Now the view finds an object type string in the descr: the code O with an
optional subarray shape, byte-order prefix and width, or the name object.
A descr that the view cannot read still makes it read the payload.
unsafe-pickle gives other signals on such files, so its version goes to 4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The container view capped each decoded member at 128 MiB, but nothing capped the sum. scanZip kept each decoded member in Archive.Members, and the read budget charged only the compressed bytes. A small zip of many highly compressed pickle members made vet hold many GiB. Now the budget of the artifact also counts the bytes that the views decode and hold, to artifact.MaxDecoded (256 MiB). decode reads a stream only to the room that the budget has left. A stream past the room gives an artifact.BudgetError and no bytes, so the view stops before it stores the member. The existing budget path then leaves the file partly checked, with a diagnostic and model-partly-checked. The budget owns the count, not one archive, because the budget is the one object that every part of the artifact shares. A decoded member can hold a zip, and that zip gets an archive of its own. A cap for each archive starts again at each such level, so a zip of zips multiplies the cap by the count of its members. unsafe-pickle gives other signals on such files, so its version goes to 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The fragments of a template kept only whether an output printed a
variable, not the conditions around the output. A template that set a
variable outside a condition and printed it inside one gave the text of
the set with the conditions of the set only. So {% set payload = '...' %}
{% if 'activate' in messages[0].content %}{{ payload }}{% endif %} gave no
signal, while the same text inline in the if gave poisoned-chat-template
and chat-template-review. A block set lost the conditions inside its
body. A macro and its body got an emitter of their own, and the macro
case dropped what its outputs printed, so a variable that only a macro
printed gave no text at all.
Now the emitter records the conditions of each output site of a
variable, and gives each fragment of a set once for each distinct list
of output conditions, with the conditions of the set. A chain of sets
and the outputs in a block set or a macro body add their conditions at
each step, and a macro call adds the conditions of the call site. A set
such as content = content ~ x adds no condition, so the lists of a common
template stay small. Each copy counts toward maxFragments.
On the research corpus, 0 of 1,724 templates go over maxFragments, and
the largest gives 20,150 fragments (643 before).
poisoned-chat-template: 1 of 741 tuning (leave one out and shipped list)
and 4 of 897 held out, as before. chat-template-review: 14 of 741 tuning
with leave one out (5 before), 8 with the shipped list (5 before), and 9
of 897 held out (7 before). Each new review hit is a default system
prompt that a template sets in a variable and prints under a condition
on message data. The same text inline in the condition gave the signal
before. The Llama (24) and Gemma (126) templates of
TestLicensedNearMisses give no signal. The macro fix adds one sentence
of the gpt-oss templates to known_sentences.txt (164 hashes).
Both checks give other signals, so poisoned-chat-template goes to
version 3 and chat-template-review to version 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…list The Insights and Threat Intel enrichers sent the name of each checkable package to SafeDep, anonymously to the community service when the run had no credentials. The inventory of vet endpoint audit sent the extension packages to SafeDep Cloud. No code decided which ecosystems may leave the machine, so a new ecosystem, such as a private model, went to SafeDep with no decision. The egress package now holds an allow list of the ecosystems whose package names vet sends. The enrichers client and the inventory ask egress.Sends before they build the wire form. A package of another ecosystem gets no data, and no request leaves the machine. The list holds every ecosystem of today, so no scan changes. TestSendsEachEcosystemOnPurpose fails for a new ecosystem until its row says whether vet sends its names. TestWireFormAsksEgress fails for a file that builds the wire form of a package and does not ask egress.Sends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
vet scan pkg:huggingface/org/name@<commit> stopped with an error of code unknown, because vet had no huggingface ecosystem. safedep/api added ECOSYSTEM_HUGGINGFACE, and dry added its name, its PURL type and identity rule 1: the rule folds the repository id to lower case, and folds a version only when it is a commit hash of 7 to 64 hex digits. This change takes dry and the API build that hold the ecosystem, and adds the ecosystem to model and to the PURL types. The PURL of a model follows purl-spec: it keeps the case of the repository id and lowers a commit hash. The report schema lists the ecosystem, and the CycloneDX group of a model is its owner. egress does not list huggingface (decision D3), because a model name can name a private model. The Insights and Threat Intel enrichers send no request for a model. Each one records an enrich_not_sent warning, so the report of a model does not read as clean. A scan of a model now completes with one package and the two warnings. The cache holds no data for the ecosystem, so no enricher version changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
TestWireFormAsksEgress looked for the text ".RawProto()" and
"egress.Sends(" in each file. A sender passed it with a package message
that it built from the raw name, with a method value of RawProto, or with
"egress.Sends(" in a comment. The enrichers client and the inventory each
asked egress.Sends on their own, and the inventory had no test for it.
egress.Wire now asks the decision table and returns the wire form. It is
the only builder of the wire form outside model. The enrichers client and
the inventory call it. egress imports the package messages of the SafeDep
API for that return type, as model does. The archtest and depguard allow
that one API package for egress.
TestWireFormGoesThroughEgress reads the Go syntax. It fails on a use of
RawProto, as a call or as a method value, and on a package message that
the code builds, outside model, egress.Wire and the test files.
TestExtensionPackageOnTheWire checks that the event of a huggingface
extension holds no package version. The comment of packageOf now says
that only the package version is gated: the event still holds the name
and the identity of each item.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The pull request comment listed only the enrich_unavailable and enrich_failed warnings of the enrichers. A scan of a Hugging Face model gave "no findings" and "Checked 1 package" with no warning, so the comment read as clean, though SafeDep did not check the model. report now holds the code enrich_not_sent with the other diagnostic codes of the report contract, so a sink can read it. The warning of the comment says that SafeDep did not check some packages, because vet keeps their names on the machine, and lists the warning of each enricher. It does not say that a check failed, and it does not tell the reader to run the job again. The line of the progress since the last push does not change, because a run again gives the same result. The other sinks list no diagnostic of an enricher, so they do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
egress and the enrichers test cited "decision D3". The policy code uses "decisions D3" for another decision of the vet v2 plan. The comments now cite FOU-690, the issue that decides whether vet may send the name of a private model to SafeDep, and give the reason. The comment of PackageVersion.PURL said that no purl-spec type folds a version. The huggingface type lowers a commit hash, so the comment now names that exception. docs/cmd/scan.md said that the scan records one enrich_not_sent warning. Each of the two enrichers records one. The insights and malysis enrichers now assert that they implement plugin.Diagnoser, as the codeusage enricher does. A change to the method then fails the build, not only the report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…ace model vet records an enrich_not_sent warning for each Hugging Face package, because it does not send the name of a model to SafeDep. --strict turns each diagnostic into exit code 3. The scan docs did not say that this includes the new warnings, so a user of --strict did not know why a scan with a model fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
vet: 3 causes to review in this pull requestNext step: Since the last push: no change No gate: 3 to review. Checked 3 added or upgraded packages at Review
The registry published this version on 2026-11-29 11:46 UTC. The cooldown is 2 days (vet default). The version can merge after 2026-12-01 11:47 UTC. Fix: Keep version 1.6.2-20261117033443-0613094abae8.1. Or wait until 2026-12-01 11:47 UTC, then run the job again. Evidence: published at 2026-11-29T11:46:09Z Finding
1 more finding: 1 infoAgent instruction file (
Maintainers: accept these causesAdd the entries to the policy file on the base branch, then run the job again. Each entry matches no other finding of this scan. An entry with no expires stays until you remove it. suppressions:
# go/buf.build/gen/go/safedep/api/grpc/go@1.6.2-20261129114609-f023fb151e78.1
- purl: pkg:golang/buf.build/gen/go/safedep/api/grpc/go@1.6.2-20261129114609-f023fb151e78.1
control: dependency-cooldown
reason: Why this is acceptable
expires: 2026-12-01T11:46:09Z
# go/buf.build/gen/go/safedep/api/protocolbuffers/go@1.36.12-20261129114609-f023fb151e78.2
- purl: pkg:golang/buf.build/gen/go/safedep/api/protocolbuffers/go@1.36.12-20261129114609-f023fb151e78.2
control: dependency-cooldown
reason: Why this is acceptable
expires: 2026-12-01T11:46:09Z
# go/github.com/safedep/dry@0.0.0-20261129122549-eafd6c51fda2
- purl: pkg:golang/github.com/safedep/dry@0.0.0-20261129122549-eafd6c51fda2
control: dependency-cooldown
reason: Why this is acceptable
expires: 2026-12-01T12:25:49ZFor AI agentsvet-agent: v1
gate: none
head: ee18b2555eb49e1bf12d37006f41b06aa49b6f57
causes:
- gate: none
control: dependency-cooldown
subject: pkg:golang/buf.build/gen/go/safedep/api/grpc/go@1.6.2-20261129114609-f023fb151e78.1
place: go.mod:7
fix: Keep version 1.6.2-20261117033443-0613094abae8.1.
wait_until: "2026-12-01T11:46:09Z"
findings: [f-4a4852febf1d52a1]
- gate: none
control: dependency-cooldown
subject: pkg:golang/buf.build/gen/go/safedep/api/protocolbuffers/go@1.36.12-20261129114609-f023fb151e78.2
place: go.mod:8
fix: Keep version 1.36.12-20261117033443-0613094abae8.2.
wait_until: "2026-12-01T11:46:09Z"
findings: [f-e5377e265ff09eda]
- gate: none
control: dependency-cooldown
subject: pkg:golang/github.com/safedep/dry@0.0.0-20261129122549-eafd6c51fda2
place: go.mod:30
fix: Keep version 0.0.0-20261121081517-bfb93f2d6a55.
wait_until: "2026-12-01T12:25:49Z"
findings: [f-f40eb0eff534b268]
other: [f-ecb7b86fce52356b]vet v2.0.0-20261130153814-db027a38edde, open source by SafeDep |
…never will The docs, the README and the pull request comment said that vet keeps the name of a Hugging Face model on the machine, because a model name can name a private model. That read as a promise. SafeDep can check the models of popular hubs later, and vet will then send the names to get that data. The text now says what vet does today and why: SafeDep has no data about models yet, so vet does not send the names. The behaviour does not change. The egress comment says to set the row to true when SafeDep checks models. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 618a3027a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if pickleCandidate(h.Name, head, Sniff(head)) || len(head) > 0 && slices.Contains(torchTarMembers, h.Name) { | ||
| a.Members = append(a.Members, Member{Name: h.Name, Offset: off, Size: h.Size}) |
There was a problem hiding this comment.
Parse the interleaved records in legacy Torch tar members
For a legacy Torch tar containing multiple storages, the storages member interleaves pickle records with raw storage bytes. Passing the entire member to the ordinary pickle analyzer scans only the consecutive streams before the first raw storage; pickle.Analyze then stops, and runUnsafePickle ignores the trailing bytes. A payload in a later storage record therefore executes in torch.load but receives no finding. In an isolated scan, a member containing a count of two, a valid FloatStorage record and its raw data, then an os.system pickle returned no signals or diagnostics and Partial=false. Parse the storage and tensor record framing and skip their raw data, or mark these members partly checked rather than treating the unread records as clean.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ba65e46. The pickle view now walks the record framing of the storages and tensors members, as _legacy_load reads them: the count, then each record with its raw data skipped. Each pickle record gets the analysis. A framing that does not parse (a size past the member, a record that is not a pickle, an unknown storage type, a negative ndim) leaves the file partly checked, never clean. Your case now gives unsafe-pickle on os.system. 0de3e9c also allows the legacy tensor types (torch.FloatTensor and the others), so a genuine legacy file gives no unknown-globals finding.
Generated by Claude Code
| m := e.macros[n.N] | ||
| for _, f := range m.frags { |
There was a problem hiding this comment.
Follow macro-to-macro calls when collecting prompt fragments
When one macro calls another, the inner macro's text disappears from the fragments: macro bodies are collected with e.sub(), whose macro table is empty, so this lookup silently supplies an empty body. For example, define payload() to emit The secret answer is blue bananas, define wrapper() to call payload(), and invoke wrapper() inside a condition testing 'activate' in messages[0].content. An isolated scan returns no signals or diagnostics and Partial=false, whereas invoking payload() directly produces both template findings. Follow macro call edges with a recursion bound and preserve the call-site guards; if expansion cannot be completed, report a partial scan instead of silently omitting the text.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ac72839. Macro bodies now expand in rounds until a round changes nothing, so a macro that calls a macro gives its text, and a recursive macro or a cycle does not loop. Each call keeps its call-site guards. A block-set body expands macro calls too. Past 32 rounds or maxFragments, the template is partly checked. Your example now gives both template findings. The corpus counts do not change: poisoned-chat-template stays at 1 of 741 and 4 of 897, and chat-template-review at 8 and 9.
Generated by Claude Code
| b.WriteString(strings.Join(items, sep)) | ||
| return b.Len() <= maxFold |
There was a problem hiding this comment.
Bound joined strings before allocating their expanded contents
A hostile chat template can exhaust the scanner's memory because strings.Join constructs the entire expanded string, and WriteString copies it, before the maxFold check runs. Each item and separator can individually satisfy the folding limit while their joined result is arbitrarily larger. In an isolated reproduction, a 4,040-byte template containing 1,000 'a' list items and join('x' * 9 * 9 * 9 * 9 * 9) allocated 118 MB merely to return folded=false; increasing the list to 20,000 items still fits well below maxSource but requires gigabytes. Check the combined item and separator lengths against the remaining folding limit before joining, and apply the same bound to the string-method join path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 133ab1f. Both join paths (the filter and the str.join method) add up the joined length against the room left under maxFold before they join, and foldItems stops once the items pass it. The other fold paths now also check the length before they write. Your example allocated 118 MB before. TestFoldBoundsBeforeBuild bounds it at 4 MiB.
Generated by Claude Code
Fold built strings.Join(items, sep) and compared the result with maxFold after the join, in the join filter and in the str.join method. Each item and the separator fit in maxFold alone, but the result did not. A 4 KB template that joins 1,000 'a' items with 'x' * 9 * 9 * 9 * 9 * 9 made Fold allocate 118 MB. A list of many long items also allocated all of the items before the join. Fold now sums the length of the result (the items, and the separator between each pair) against the room that is left under maxFold before it joins. foldItems stops when the items hold more than maxFold bytes. The other steps (a literal, the repeat with *, replace, the format filter, the % operator, str.format, the printf of a Go template, the string filters and methods) now also check the length before they write. Their excess was at most one step (9 times 64 KiB), but each step now allocates at most maxFold. str.format writes into the shared builder, so its limit counts the text before it. The folded value of each expression does not change, so no check changes its output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…gacy torch tar The storages and the tensors members of the legacy tar format of torch.save are not one pickle stream. vet gave each member to the pickle analyzer as one stream. The analyzer stopped at the first raw bytes, so a pickle in a later record gave no finding. A storages member with a count of 2, one FloatStorage record and its data, and then an os.system pickle passed as clean. The framing follows _legacy_load in torch/serialization.py of PyTorch 2.5. torch.load reads each pickle with pickle.load on an unbuffered file, so the raw bytes start right after STOP: - storages: a pickle of the count, then for each storage a pickle of (key, location, storage type), an int64 count of elements (little-endian) and the data, then a pickle of the storage views. - tensors: a pickle of the count, then for each tensor a pickle of (key, storage key, tensor type), an int32 ndim, 4 bytes that torch skips, ndim sizes and ndim strides as int64, and an int64 storage offset. The container view now gives the two members a dialect (DialectTorchStorages, DialectTorchTensors). The pickle view walks the records of a part with such a dialect on one cursor, analyzes each pickle record, and skips the raw bytes. The size of an element comes from the storage type of the record. The walk keeps the read budget, the opcode and value limits, and a cap of 16,384 records. When the framing does not parse (a count that is not an integer, a size past the member, a storage type that vet does not know, a negative ndim, bytes that do not start a pickle, or a record that does not end at STOP), the analysis gets a Problem. unsafe-pickle reports it as a diagnostic, so the file is partly checked and never clean. unsafe-pickle goes to version 6, because its output changes for these files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The template view collected the body of each macro with an emitter
that had no macros. A call in the body of a macro or of a block set
then expanded to nothing. A template that put its payload in payload(),
called payload() from wrapper(), and called wrapper() under
{% if 'activate' in messages[0].content %} gave no signal. A call of
payload() at that place gave both template findings.
The view now expands the macro bodies in rounds. Each round expands
each call in a macro body with the bodies of the round before, and keeps
the guards of the call. A block set body gets the same bodies. The
expansion stops when a round changes no body, so a macro that calls
itself, directly or through a cycle, does not loop. When a chain needs
more than 32 rounds (maxMacroRounds), or a round gives more than
maxFragments, the facts are not complete, and the checks report the
template as partly checked.
A recursive macro gives its fragments again under each subset of the
guards of its calls. On the corpus, exact copies made 9 templates go
over maxFragments, and the Gemma 4 templates took 0.3 s each. The
checks read only the guards that read message data (Facts.ReadsData).
So a macro body keeps one copy of a fragment for each set of those
guards, the copy with the fewest other guards, and follow adds an
output site only for a new set of those guards. The trigger and review
rules see the same guards on message data as with all copies.
Corpus (VET_MODEL_TEMPLATE_CORPUS, TestTemplateCorpus and
TestLicensedNearMisses), before and after:
- poisoned-chat-template: 1 of 741 tuning, 4 of 897 held out. No
change, and the same repositories.
- chat-template-review: 8 tuning with the shipped list, 9 held out.
No change.
- Llama (24) and Gemma (126): no signal. No change.
- Templates over maxFragments: 0. No change. The longest chain of
rounds on the corpus is 7.
- Fragments in all: 542,285 tuning and 670,189 held out before; 408,836
and 507,272 after, because follow merges the sites that differ only
in guards that do not read message data.
known_sentences.txt gains 21 hashes (164 to 185). The text of the
gpt-oss templates under render_builtin_tools now reaches the fragments,
because build_system_message calls that macro. Each sentence is in 5
tuning templates. Examples: "use this tool to execute python code in
your chain of thought", "searches for information related to query and
displays topn results", "the drive at mnt data can be used to save and
persist user files".
poisoned-chat-template goes to version 4 and chat-template-review to
version 3, because their output changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A record in the tensors member of a legacy torch tar names the type of its tensor, such as torch.FloatTensor. The pickle allowlist held the legacy storage types but not the tensor types, so each genuine legacy .pt file gave an unknown-globals finding. The test of a clean legacy file used torch.FloatStorage as the tensor type and did not show it. The allowlist now holds the ten legacy tensor types next to their storage types. They are type objects that build a tensor, as the storage types build a storage. pickleGlobalsVersion goes to 3 with its pinned hash, and the clean case uses torch.FloatTensor and torch.LongTensor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
abhisek
left a comment
There was a problem hiding this comment.
I recommend changes before merge. The PR comparison can drop a finding that became critical, and a README-only change can fail on a finding in an unchanged model. The inline comments also cover Git LFS, stable finding IDs, read costs, and safetensors compatibility. I verified the behaviors at 618a302 and checked the affected code against 0de3e9c before posting.
| // version of a file. It leaves out the offset and the line, which an edit | ||
| // elsewhere in the part moves. | ||
| func signalKey(s check.Signal) string { | ||
| return s.Check + "\x00" + s.Ref() + "\x00" + s.At.Key + "\x00" + finding.NormalizeSnippet(s.Visible) |
There was a problem hiding this comment.
P1 · Report increases in severity. The comparison drops a head signal as soon as its location and visible evidence match a base signal. A benign test control produced a medium finding at the base, a critical finding in the full head scan, and zero findings in the PR scan. Account for the grade when matching so that the severity gate sees the increase.
There was a problem hiding this comment.
Fixed in 346304b. The comparison now matches a head signal to a base signal by key and keeps the lowest base severity. A head signal with a higher severity than its match is reported with the change MODIFIED, so the severity gate sees it. Your case (medium at the base, critical at the head) now gives the critical finding.
Generated by Claude Code
| switch { | ||
| case ok: | ||
| a.closers = append(a.closers, f) | ||
| case info.Size() > maxBuffered: |
There was a problem hiding this comment.
P1 · Preserve the baseline for large models. The Git tree reader has no random access, so a base model above 64 MiB goes unread. In a README-only change, vet marked a 65 MiB model UNCHANGED and its existing high finding ADDED. The unrelated change failed --fail-on high. Skip evaluation for byte-identical models and provide a readable baseline for genuinely modified ones.
There was a problem hiding this comment.
Fixed in 5ae2332. A model file that the change keeps byte for byte now gives no finding. A modified model over 64 MiB reads its base through a temporary file that grows only as far as the reads go: a GGUF or safetensors base costs its header, a zip costs its whole size. vet never holds the file in memory, removes the temporary file after the scan, and reads a base of up to 16 GiB. Your 65 MiB README-only case gives no finding and exits 0.
ffce0b3 changes one part of this commit. When vet cannot read the base of a changed file, it now keeps each head finding with the change MODIFIED, next to model-partly-checked, so a payload that the change adds still reaches the gate.
Generated by Claude Code
| func SameBlob(fsys fs.FS, rel string, base plumbing.Hash) (bool, error) { | ||
| data, err := fs.ReadFile(fsys, rel) | ||
| var crlf crlfCounter | ||
| sum, err := hashBlob(fsys, rel, 0, func(w io.Writer) io.Writer { return io.MultiWriter(w, &crlf) }) |
There was a problem hiding this comment.
P2 · Compare fetched LFS files with the object named by the pointer. Git stores the pointer in the base tree while the working tree holds the fetched model. In a README-only change, git diff --name-only listed only the README, but vet marked the model MODIFIED and its existing finding ADDED. Use the pointer’s SHA-256 and size to recognize unchanged content.
There was a problem hiding this comment.
Fixed in 505f22c. vet now parses a Git LFS pointer at the base (the strict three-line form) and records its oid and size. A work file whose size and SHA-256 match is unchanged. vet compares the size first and hashes the file as a stream only when the size matches. The base cache goes to version 4. Your README-only case is now UNCHANGED and exits 0.
Generated by Claude Code
| // not look like a clean result. | ||
| func (c *input) warning(b *strings.Builder) { | ||
| checks, files := gaps(c.view.Diagnostics) | ||
| kept := notSent(c.view.Diagnostics) |
There was a problem hiding this comment.
P2 · Show skipped LFS models in the PR comment. Adding an unfetched model produced model_lfs_pointer in JSON. The PR comment said “no findings in this pull request” and omitted that vet had checked no model bytes. Include pointers added or modified by the change in the coverage warning, along with the instruction to fetch the model.
There was a problem hiding this comment.
Fixed in 5ebd111. The coverage warning of the pull request comment now names the Git LFS pointers that the change adds or edits, and says to run git lfs pull in the job before the scan. The code moved to report.CodeModelLFSPointer.
Generated by Claude Code
| base[k]-- | ||
| continue | ||
| } | ||
| f := c.finding(m.Path, s, seen) |
There was a problem hiding this comment.
P2 · Assign occurrence IDs before filtering base matches. With one occurrence at the base and two at the head, the full scan gave the second occurrence a distinct ID. The PR scan gave that new occurrence the first occurrence’s ID because the counter advances only after base matches are removed. A suppression for the first ID can then hide the second finding.
There was a problem hiding this comment.
Fixed in 346304b. The control numbers the occurrences on the whole head before the base drops a signal, so a finding has the same id in a full scan and in pull request mode. A test compares the ids of the two modes with one occurrence at the base and two at the head.
Generated by Claude Code
| // name that a renamed model can have. | ||
| func (Extractor) FileRequired(api filesystem.FileAPI) bool { | ||
| p := filepath.ToSlash(api.Path()) | ||
| return artifact.ByPath(p).Kind != "" || sniffed[strings.ToLower(path.Ext(p))] |
There was a problem hiding this comment.
P2 · Sniff ambiguous files before copying their entire contents. A cold --base-ref scan copied an 8 MiB ordinary calibration.dat into the temporary base, read 64 bytes there, and hashed the working file. It produced no model manifest. Check the prefix before materializing or hashing a file selected only by this extractor.
There was a problem hiding this comment.
Fixed in 4b30613. The extractor now sniffs the prefix of a file that only it selects before it copies the file into the base or hashes it. Your cold --base-ref case leaves no base cache entry for calibration.dat.
Generated by Claude Code
| // overlaps and the trailing bytes. A strict loader takes only data that | ||
| // the tensors cover exactly, so any other byte is room for a payload. | ||
| func (f *File) layout() error { | ||
| slices.SortStableFunc(f.Tensors, func(a, b Tensor) int { return cmp.Compare(a.Begin, b.Begin) }) |
There was a problem hiding this comment.
P2 · Handle empty tensors that share a start offset. When the populated tensor appears first in the JSON header, it advances the cursor past an empty tensor at the same start. The reference library loaded the file, but vet emitted a high malformed-model-file finding and failed --fail-on high. Order equal starts by end offset before checking overlap.
There was a problem hiding this comment.
Fixed in 602d40c. The view orders tensors with the same start by their end, so an empty tensor comes first and the cursor check passes. A real overlap or gap still gives malformed-model-file.
Generated by Claude Code
|
|
||
| // bits is the size of one item of each dtype of the safetensors format. | ||
| var bits = map[string]uint64{ | ||
| "BOOL": 8, "U8": 8, "I8": 8, "F8_E5M2": 8, "F8_E4M3": 8, "F8_E8M0": 8, |
There was a problem hiding this comment.
P2 · Include both FNUZ FP8 types. The reference safetensors library (0.8.0) loaded files containing F8_E4M3FNUZ and F8_E5M2FNUZ. Vet reported each one as malformed and partly checked. Add both eight-bit encodings to the width table and cover them with a reference-compatible fixture.
There was a problem hiding this comment.
Fixed in 602d40c. F8_E4M3FNUZ and F8_E5M2FNUZ are in the width table, with a fixture. The rest of the safetensors 0.8.0 dtype list was already there (BOOL, U8, I8, F8_E5M2, F8_E4M3, F8_E8M0, I16, U16, F16, BF16, I32, U32, F32, F64, I64, U64, C64, F4, F6_E2M3, F6_E3M2).
Generated by Claude Code
| return inventory.Inventory{}, err | ||
| } | ||
| head = head[:n] | ||
| if bytes.HasPrefix(head, []byte(lfsPointer)) { |
There was a problem hiding this comment.
Distinguish ambiguous LFS pointers from known model paths. An LFS pointer for ordinary tabular data named cities.dat generated a skipped-model warning and made --strict exit 3. A generic filename and a pointer alone do not identify the content as a model. Reserve the model-specific diagnostic for paths or metadata that identify a model.
There was a problem hiding this comment.
Fixed in 4b30613. The model LFS diagnostic now needs a path that names a model format or a model file name. A cities.dat pointer gives no warning and --strict exits 0. A pointer named like q4.gguf still warns. A .bin pointer still warns, because .bin is in the model format table, so firmware.bin also warns.
Generated by Claude Code
| } | ||
|
|
||
| func isModel(p string, head []byte) bool { | ||
| if len(head) == 0 { |
There was a problem hiding this comment.
Report an empty file with a known model extension. A zero-byte empty.gguf produced zero manifests and zero diagnostics, even with --strict. Keep explicitly named formats eligible for header validation so an incomplete checkpoint receives a diagnostic.
There was a problem hiding this comment.
Fixed in 4b30613. A file with an explicit model extension stays eligible when it is empty, so empty.gguf now gives malformed-model-file and model-partly-checked. An empty .bin still needs a model magic, because the extractor has no list of model file names for .bin.
Generated by Claude Code
…l scan In pull request mode the model control dropped a head signal when the base had a signal with the same key. The key holds no grade, so a signal that went from medium at the base to critical at the head gave no finding. The control also gave the occurrence ids after it dropped the base matches. With one occurrence at the base and two at the head, the new occurrence got the id of the first occurrence of a full scan. A suppression of the first occurrence then hid the new one. The control now numbers the occurrences on the whole head first, so a finding has the same id in a full scan and in pull request mode. It then pairs the head and the base signals of one key from the lowest severity up. A head signal that the base had only at a lower severity gets the change MODIFIED, and the gate sees it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
The Git tree of the base commit gives no random access, so the model control left a base model over 64 MiB unread. The base then had no signal, and pull request mode reported each existing signal of the head as ADDED. A change to a README alone failed --fail-on high, because the model control also checked a model that the change kept byte for byte. The model control now skips a model file that pull request mode marks UNCHANGED, because the change adds no signal to it. For a changed file, artifact.Local reads a stream through a temporary file. The temporary file holds only the bytes up to the last byte that a view reads, so a GGUF or a safetensors base costs its header, and vet never holds the file in memory. Close removes the file. A stream over 16 GiB stays unread. When vet cannot read the base, the control reports model-partly-checked with the change MODIFIED, and no head signal as ADDED, because it cannot tell which signals the change adds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Git keeps a Git LFS pointer in the base tree, and a checkout with Git LFS holds the model in the working tree. Pull request mode compared the git blob hash of the model with the hash of the pointer, so a model that the change kept read as MODIFIED, and its existing findings as ADDED. The base now records the object that each Git LFS pointer names: the SHA-256 and the size from the lines "oid sha256:<hex>" and "size <n>". A head file with the size of the pointer and the same SHA-256 is unchanged. vet compares the size first, and hashes the file as a stream only when the size matches. The base cache gets version 4, because it keeps the pointers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A cold --base-ref scan copied an ordinary calibration.dat of 8 MiB into the temporary base, read 64 bytes of it there, and hashed the head file. The model file extractor wants a file with a name that a renamed model can have, but keeps it only for some first bytes. Pull request mode did the costly work before the extractor read those bytes. An extractor can now be a scalibr.Sniffer. scalibr.Sniffed reads the first 64 bytes of a file only when a Sniffer wants the file, and drops each Sniffer that does not want those bytes. Pull request mode calls it before it copies a base file, and before it extracts and hashes a head file. The model file extractor is a Sniffer. The extractor also changes what its first bytes decide: - An empty file with a name that a model format claims, other than .bin, is a model file. vet gave no manifest and no diagnostic for an empty empty.gguf, even with --strict. The model control now reports its short header. - A Git LFS pointer is a skipped model only when its path claims a model format or a model file name. A pointer of ordinary data, such as cities.dat, gave the skipped-model warning, and --strict exited 3. The extractor gets version 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
A change that added a model as an unfetched Git LFS pointer gave the model_lfs_pointer warning in the JSON report. The pull request comment said "no findings in this pull request", and did not say that vet checked no model bytes. The coverage warning of the comment now names each Git LFS pointer that the change adds or edits, as it names a file that vet cannot read. It tells the reader to run git lfs pull in the job before the scan. A pointer that the change keeps hides no finding of the change, so the comment leaves it out. The code model_lfs_pointer moves to the report package, because a reader of the report acts on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…s 0.8.0 does The safetensors view ordered the tensors by start only. When a tensor with data came first in the JSON header, it moved the cursor past an empty tensor at the same start. vet then gave a high malformed-model-file finding for a file that the reference library loads. The view now orders tensors of one start by their end, as the reference library does, so the empty tensor comes first. A real overlap or gap still gives its finding. The view also did not know the dtypes F8_E4M3FNUZ and F8_E5M2FNUZ, which the reference library loads with one byte for each item. vet reported such a file as malformed and partly checked. The width table now has them. The other dtypes of safetensors 0.8.0 were already in the table. malformed-model-file gets version 3 and model-payload-carrier gets version 2, because both read the view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
…read In pull request mode, when vet could not read the base version of a changed model file, the model control reported only model-partly-checked and dropped each other finding of the file. A payload that the change adds then gave no finding, and the gate passed. The control now reports each finding of the file with the change MODIFIED, next to model-partly-checked. vet cannot tell which signals the base had, so it keeps them all. An unchanged file still gives no finding, and a large base now has a readable copy, so this path is rare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
|
The "Open Source Software Supply Chain Security Scanner" check fails on ffce0b3 because the diff of this pull request is now over the 1 MB limit that GitHub gives the SafeDep app. The pull request has 189 files, under the 300-file limit. The check passed on each earlier head. The failure is not in the code. The only fix is to split the pull request, and this pull request stays as one branch on purpose. The dependency changes are in Generated by Claude Code |
The diff of this branch is over the 20,000 lines that GitHub serves to the lint action, so the action lints the whole repository and not only the changed lines. The whole run finds one gci issue that v2 already has: a struct field in lockfile_test.go that is not aligned. This change aligns it, so the whole run is clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
What
vet scan .now finds the model files in a repository and reports model attacks. vet reads only the bytes it needs. It never unpickles a file and never renders a template. This is P0a of the project "vet: AI model scanning" (P-FOU-44): local files only, with no hub client, no network and no token.vet scan pkg:huggingface/<org>/<name>@<sha>now parses and reaches the engine (FOU-704). No hub client reads the repository yet (P0b), so the scan checks the package identity only. SafeDep has no data about models yet, so vet does not send a model name to SafeDep today (FOU-703). A later version can send it when SafeDep checks models.Each model control warns (
Attack: false). No control changes the--fail-on attacksgate yet. FOU-718 promotes a control after a clean false-positive run.Issues
checktest,scanmodelfinding family and themodelcontrol. The control owns the severity and the confidence.poisoned-chat-templateandchat-template-reviewmodel-payload-carrierandmalformed-model-fileunsafe-pickle(runs code, evasive, unknown) andevasive-model-archivemodel/fileextractor, themodelmanifest kind, pull request mode, acceptance scriptsnet,os/execortext/templatein the SDKhuggingfaceecosystem inmodel,ParsePURLand the report schema, with dry and the API SDK bumpedmodel-partly-checked(medium) reports a file that vet checked only in part, for example when the read budget or the decoded-byte cap runs out, or a container format is not read. Such a file is never reported as clean.Design
hxxps[:]//x[.]example). It never shows payload bytes.Hugging Face packages (FOU-704, FOU-703)
PURL()keeps the case of the namespace and the name as written, and lowers a commit hash. The report keepsraw_nameandraw_version.internal/plugins/internal/egressholds the one decision table of ecosystems whose package names vet sends to SafeDep. A missing row means "not sent". Hugging Face has afalserow today, because SafeDep has no data about models. The row becomestruewhen SafeDep checks models; this is not a promise that vet never sends a model name.egress.Wireis the only builder of the wire form of a package outsidemodel. The Insights and malysis enrichers and thecloud-inventorysync call it.TestSendsEachEcosystemOnPurposefails for an ecosystem with no row.TestWireFormGoesThroughEgressreads the Go syntax. It fails on anyRawProtoselector (call, method value or method expression) and any package message literal outsidemodelandegress. A reviewer's three bypasses of the first version of this test now fail it.egressmay import the package messages of the SafeDep API, asmodeldoes. The archtest and the depguard rule allow that one package only.pkg:huggingfacescan exits 0, with oneenrich_not_sentwarning for each enricher. The pull request comment shows them under its WARNING block: "SafeDep does not check some packages yet, so vet did not send their names. A finding can be missing."--strictfails such a scan with exit 3, as it does for each gap in the checks, anddocs/cmd/scan.mdsays so.bfb93f2toeafd6c5(chore(deps): bump golang.org/x/oauth2 from 0.18.0 to 0.19.0 #202, plus additive gRPC options and API key metadata that vet does not need yet). The API SDK moves to the build of safedep/api#285. go.sum changes only for these three modules.pkg:huggingfacecomponent drops it with no diagnostic, because Scalibr's CycloneDX extractor rejects the PURL.enrich_not_sentwarning.ghcppull request comment proxy relays the comment body, which can name packages. It posts what the user asked to post.pkg:deb) still gives anunknownusage error.Measured
poisoned-chat-template: 1 of 741 tuning repositories and 4 of 897 held-out repositories give a false positive. The counts did not change after the review fixes.chat-template-review: 8 tuning and 9 held-out (5 and 7 before the fix that keeps the conditions of an output on the text of a variable). Each new hit is a benign default system prompt in a variable that the template prints under a condition on message data. The control warns with an unknown grade.checktest.The attack cases are synthetic, so the detection rates are optimistic. The false-positive rates come from real models.
Review
Three reviews ran before this PR: functionality and adversarial, SOLID and DRY, and maintainability. CodeQL and Codex reviewed the PR, and a fourth review covered the Hugging Face commits. The fixes are in this branch:
replace,reverse,format,%,joinor Goprintfgraded clean. Each template rule now sees the folded string.os.systemscanned clean. vet now reads the tar format. A container format that vet does not read gives "partly checked".data.pklthat starts with a harmless opcode such asN0was skipped. A member with a pickle name is now read whatever its first opcode.'|O'was skipped.malformed-model-filenow reports it.\Uescape above U+10FFFF gave U+FFFD with no error (CodeQL). The lexer now rejects it.scanpackage. A signal carries a structured origin. A grade over the maximum of its check is an error.enrich_not_sentwarnings, so a scan of a model read as clean there.joinbefore it checked the size limit. Each fold path now checks the length first.storagesortensorsmember of a legacy torch tar scanned clean. vet now walks the record framing, and a framing that does not parse leaves the file partly checked.torch.FloatTensor.The owner's review found these, and the branch fixes them:
ADDED. vet now skips an unchanged model and compares a fetched file with the oid and size of the pointer.MODIFIED, next tomodel-partly-checked.F8_E4M3FNUZandF8_E5M2FNUZdtypes, as safetensors 0.8.0 does..ggufnow gives a diagnostic. A generic.datGit LFS pointer no longer gives the model warning. vet sniffs an ambiguous file before it copies or hashes it.FOU-728 holds the review items that are out of scope here: hub seams, shared helpers and upkeep.
Merge
Squash merge only. Commit 9c640a4 in this branch holds Llama template text as test data. 41a2eeb removes it, and a squash merge keeps it out of
v2.Test
make checkpasses: build, vet for each OS, tests, lint, hermetic acceptance.scan/models/repository,scan/models/pr-changeandscan/sources/huggingface. The last one asserts zero calls to the Insights and malysis stubs today, and the warnings in the pull request comment.vet scan 'pkg:huggingface/Microsoft/DeBERTa-v3-base@559062AD...'exits 0, gives the namemicrosoft/deberta-v3-basewithraw_nameMicrosoft/DeBERTa-v3-base, a lowercase hash, and the two warnings.--report pr-comment=..., the comment carries the WARNING block. With--strict, the scan exits 3.https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Generated by Claude Code