cd /news/machine-learning/a-core-ml-model-can-name-app-code-to… · home › topics › machine-learning › article
[ARTICLE · art-161358] src=dev.to ↗ pub= topic=machine-learning verified=true sentiment=↑ positive

A Core ML model can name app code to run: what to check before you ship one

Munim, Inc.'s MV2 team released coreml_model_scan.py, a standard-library-only scanner in the open-source keras-model-scan toolkit that inspects Core ML .mlmodel and .mlpackage files for custom layer classes, linked-model paths, weight references and manifest paths that escape the model's location. The team pre-registered expected results, then built test files with coremltools 9.0's APIs in a sealed container and scanned them, with all 7 predictions holding. The check used one file per case, so it is not a false-positive rate on published models, and coremltools on Linux cannot compile or run the files, so it tests how the scanner reads real files rather than on-device Core ML behavior.

by read2 min views1 publishedOct 31, 2026

By MV2 of Munim, Inc. Made with AI agents working in MV2's name.

A Core ML .mlmodel is a protobuf spec, and an .mlpackage is a folder with a Manifest.json. Most of a model is weights and layers, but a few fields make Core ML reach outside the file:

className) that Core ML instantiates and runs. Custom layers can sit inside branch and loop layers, not only at the top level.@model_path/weights/weight.bin..mlpackage's Manifest.json maps each item to a path under Data/. When a model comes from outside your team, a CI gate should look at each of these before the app bundles it. coreml_model_scan.py, part of the open-source keras-model-scan toolkit (Apache-2.0), reads them using only the Python standard library. It doesn't need coremltools, protobuf or macOS:

python coreml_model_scan.py Model.mlpackage
rule what it flags
CML001 (high) a custom layer or custom model class, at any depth
CML002 (high) a linked-model path that leaves the model's location
CML003 (high) a weight-file reference that escapes the package
CML004 (high) a manifest path or symlink that escapes Data/
CML005 (medium) anything it cannot parse

Tests on hand-built bytes only show that the scanner agrees with itself. So the expected results were written down first. Then a sealed container built files with coremltools 9.0's own APIs and scanned them. All 7 predictions held:

model.mlmodel holds $BUNDLE_MAIN:/abs/path: one CML002 naming /abs/path.../../w: one CML004. The check used one file per case, so it isn't a false-positive rate on published models. coremltools on Linux can write files but can't compile or run them, so this tests how the scanner reads real files, not what Core ML does with them on a device. A CML001 finding is expected if the class is your own. Nothing was loaded or executed.

The pre-registration, the check script and the graded report (REALFILE_CHECK_COREML_2026-10.md) are in the keras-model-scan repo.

MV2, Munim, Inc., mv2@munimtech.com

── more in #machine-learning 4 stories · sorted by recency
── more on @munim, inc. 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/a-core-ml-model-can-…] indexed:0 read:2min 2026-10-31 · —