
Hayward
io.github.hedgerow-devPublished by GitHub account hedgerow-devv1.4.1Updated Oct 30, 2026
Checks ML model files (pickle, PyTorch, joblib, NumPy, GGUF, ONNX) for code that runs on load.
Overview
Static security scanner that lets an assistant check ML model files for code that would run on load, before a checkpoint is loaded.
- What you can do
- Scan model files and directories for unsafe callables that execute on load, across pickle-based, tensor, graph and repo-config formats
- Report findings with severity tiers, coverage gaps and JSON or HTML output
- Judge unknown callables by the arguments they were handed rather than by name
- Run as a coding-agent tool before a model is loaded, alongside CLI, GUI, Python API, pre-commit hook and CI use
- When to use it
- Useful when pulling checkpoints from public hubs or untrusted sources and you want the assistant to inspect them before loading, including in CI pipelines or offline regulated environments.
- Requirements
- Runs locally over stdio as a Python package (Python 3.10+) installed with the mcp extra and started via uvx or the hayward mcp command. No authentication, environment variables or headers are declared; the scanner itself makes no network calls.
Installation
In SourceWeft
- Open Hayward in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Hayward
Hayward is a static security scanner for machine-learning model files.
It scans PyTorch, pickle, joblib, GGUF, SafeTensors, ONNX and Keras files, plus
Hugging Face config.json, and tells you whether loading a checkpoint would run
code, before you load it.
[License MIT] [Python 3.10+] [Rules 47] [Dependencies 1] [Scan makes no outbound calls] [GitHub Marketplace]
Or try it in your browser. Same scanner, compiled to WebAssembly. Drop a checkpoint on the page and it stays on your machine.
Guard the load itself
A scan checks a file before you load it. The guard checks it while you do:
It also stops from_pretrained(..., trust_remote_code=True) from running a
repo's own Python code, unless you name the repo with
hayward.guard.install(remote_code=["org/name"]).
Each load is scanned first, then every function the file asks for is checked
before it runs. The default mode raises the bar but is not a sandbox. For
files you do not trust, hayward.guard.install(strict=True) refuses anything
not on the known-safe list. With hayward.guard.install(verified="strict"), a
file loads only if the signed verdict log vouches for its exact bytes. The
usage guide lists what it does not cover.
Let your coding agent check first
[Claude Code calls Hayward over MCP, refuses a booby-trapped checkpoint and clears a normal one]
The problem
torch.load, joblib.load and numpy.load(allow_pickle=True) execute code
from the file they read. That is not a bug, it is what pickle does.
The file is named pytorch_model.bin, and the .bin is doing a lot of work
in that sentence. It is a program. Loading it is running it, on your laptop,
with your credentials, as you.
Who it is for
Teams that pull checkpoints from public hubs and want the check to run in a CI pipeline, on a laptop, or inside a regulated environment where nothing is allowed to leave the network.
What makes it different
It stays quiet. A gate that cries wolf gets switched off, so it is built to report real models cleanly and reserve the INFO tier for content it could not verify. Any figures we quote are self-measured and not independently reproducible; Accuracy sets out what it does and does not support, and the harness runs it against your own corpus.
It tells you when it could not look. A container it could not fully walk, or content it could not verify, gets an explicit coverage finding rather than a clean verdict, and a parse error never erases what was already found. Attackers hide payloads behind deliberate parse errors, so a payload followed by junk still scans as critical. One honest limit: bytes that match no model format at all, from the first byte, report nothing.
It catches gadgets nobody has listed. Unknown callables are judged by the arguments they were handed, not by their name. A URL, a shell command, a host and port. That is what generalises past the deny list.
It installs anywhere. One dependency, no model framework, no native
extensions, and hayward scan makes no network calls. Python 3.10 and up.
It fits a build. Documented exit codes, JSON output, a threshold you set.
What it scans
26 extensions in total. Format comes from magic bytes, so a payload
renamed weights.safetensors, or weights.dat, or given no extension at
all, does not walk past on the strength of its name. A directory scan still
finds its candidates by extension first, since sniffing a whole tree means
reading it: coverage states that limit.
Ways to run it
Or as the load guard, a pre-commit hook, or an MCP server a coding agent calls before it loads a model.
And in CI, as a GitHub Action that fails the build and uploads SARIF to code scanning:
See the GitHub Action guide, or the listing on GitHub Marketplace.
What a clean result means
That Hayward read the files and recognised nothing dangerous in them. Not that the model is safe. It is a smoke alarm, not a survey of the building, and coverage is the page where it owns up to the rooms it could not get into.
Documentation
- Usage: CLI reference, exit codes, CI, pre-commit, the GUI, the MCP server, the Python API, the load guard
- Rules: all 47 rules with severities and CWE mappings
- Coverage: what it does when it cannot read a file, and why that is a finding
- How it works: how it reads pickle without running it, and how unknown callables are judged by their arguments
- GitHub Action: run the scan in CI and upload SARIF to code scanning
- Reproducible builds: the Docker image and the browser-demo build pipeline
- Accuracy: measured results, the caveats, and where it loses
Contributing
The most useful contribution is a file Hayward gets wrong. False alarms count just as much as misses. A scanner nobody trusts is a scanner nobody runs, and then it may as well not exist.
Security
Report vulnerabilities in Hayward to [email protected] rather than in an issue. Input that crashes the scanner counts: under a CI gate, a crash is indistinguishable from a scan that never ran.
Licence
A hayward was the parish officer who walked the hedges, checked the gaps and impounded whatever had got through.
Source: README.md at commit 94ef325
Tools
0Version history
1- v1.4.1LatestOct 23, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts