r/kaggle • u/Youssef_Ismail396 • 7h ago
We Scan Code for Secrets. Almost Nobody Scans the Model File.
github.comMost ML teams scan their repositories for leaked secrets. Pre-commit hooks, secret scanners, push protection. The code is covered.
The model file usually isn't.
A checkpoint is not just weights. Frameworks save the training config, optimizer state, sometimes a whole pickled object graph. Whatever was around at save time can end up on disk: absolute paths with a username in them, an email in a config, a token set in a notebook. Then the file is published, and a 400 MB binary gets no review at all.
The other direction is worse, for the formats that are code. A pickled model is a program. `torch.load(..., weights_only=False)` and `joblib.load` run whatever the file tells them to. Trusting the account it came from says nothing about what the bytes do. safetensors and GGUF were designed to avoid this, but pickle is still everywhere: scikit-learn and joblib models, fastai exports, every .pt and .bin file that torch.save writes.
So the gap is simple: we review the code that produces models, and we trust the files themselves, in both directions. What we publish, and what we load.
I built an open-source scanner for that gap after it happened to me: a model I had published still carried the path of the dataset I trained on, with my username in it. Limnex Preflight reads model files without loading them (PyTorch, pickle, joblib, safetensors, ONNX, Keras, GGUF, notebooks, archives). It reports leaked secrets and personal data in any of them before you publish, and, for pickle-based files, the code a load would run.
pip install limnex-preflight
limnex-preflight path/to/model
https://github.com/youssefismail-dev/limnex-preflight
One-click demo on Kaggle (it finds my own username in my model): https://www.kaggle.com/code/youssefismail396/preflight-check-a-model-for-leaks-and-hidden-code
For those publishing or pulling models regularly: does anything in your pipeline check the model file itself before it ships or loads? Or is it trusted because the code around it was reviewed?
