Join our Newsletter — 33% off our NHI Course
Home› Guides› MLOps Security for Beginners: Keeping the Pipeline That…
Guide AI Threats & Model Security

MLOps Security for Beginners: Keeping the Pipeline That Builds AI Models Safe

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 1 December 2026 11 min read
On this page

MLOps security protects every step that turns data into a running AI model. That covers the data, code, model files, tools and the accounts that move them along.

This guide is for new machine learning engineers, students and anyone joining an AI team. You do not need to be a security expert. If you train, store or deploy models, you are already part of an MLOps pipeline.

In short

  • MLOps is the assembly line for AI models: data in, trained model out, then deployed and monitored.
  • Each stage can be attacked: poisoned data, tampered model files, unsafe downloads and stolen pipeline credentials.
  • Some model file formats can run code when they are loaded, so a downloaded model can be as risky as a downloaded program.
  • Start with the basics: know your pipeline, use safe file formats, check model files before use, and give pipeline accounts only the access they need.

What you will learn

  • Describe the main stages of an MLOps pipeline in plain words.
  • Name the common ways each stage can be attacked.
  • Explain why model files and pipeline accounts need protecting.
  • Take first steps to make your own pipeline safer.
Pipeline
a chain of automated steps, each passing its output to the next.
Model file (model artifact)
the saved, trained model that gets stored, shared and deployed.
Model registry
the shelf where approved model files and their versions are kept.

What is MLOps security?

Think of a bakery that supplies supermarkets. Flour arrives, recipes are tested, loaves are baked, packed, labelled and shipped. If someone swaps the flour, edits a recipe or sticks a fake label on a box, customers get something they did not order.

MLOps is the same chain for AI. Data is collected and cleaned. Models are trained and tested. The best one is saved to a model registry. Then it goes live so apps can use it. MLOps security makes sure nobody can quietly swap the flour, the recipe or the label.

The UK's national cyber agency splits safe AI work into four stages: design, build, deploy, and run. Checking outside parts belongs in the build stage. Guarding models belongs in deploy. Logs and alerts belong in the run stage [1].

Where the comparison stops working: a bad loaf is usually easy to spot. A tampered model can look and score normally in tests and only misbehave in rare cases.

If you are new to pipelines in general, CI/CD Pipeline Security for Beginners covers the software side. This page focuses on what is different for models.

Why does it matter?

A pipeline often holds key data, key models and strong passwords and keys in one place. A weak spot at any stage can hurt every app that uses the model.

If you are a new ML engineer

What could happen: you download a pre-trained model from a public hub, and loading it runs hidden code on your machine.

Check this: prefer safe formats such as safetensors and models from publishers you trust.

Next: AI Supply Chain Security for Beginners

If you lead an AI or data team

What could happen: nobody can say which data and code produced the model now in production.

Check this: ask whether every deployed model has a recorded source, version and approver.

Next: Securing the Model Registry

If you are new to security work

What could happen: a training job's cloud key with broad access is left in a notebook and copied by an attacker.

Check this: treat pipeline accounts as non-human identities with owners, limited access and short-lived secrets.

Next: Non-Human Identities for Beginners

What does it look like?

Here is a made-up pipeline settings file for a training job. Look at what each line controls.

Example only. All values are made up.

# EXAMPLE training job settings
base_model:   example-hub/EXAMPLE-model   (format: pickle)   (1)
dataset:      s3://EXAMPLE-bucket/data-v0/                    (2)
run_as:       EXAMPLE-train-sa  (role: admin)                 (3)
api_key:      EXAMPLE-KEY-0000-NOT-REAL                       (4)
push_to:      registry/EXAMPLE-model  (signing: off)          (5)
  1. A base model downloaded from a public hub in pickle format, which can run code when loaded.
  2. The training data location. Anyone who can write here can change what the model learns.
  3. The account the job runs as. An admin role means a hijacked job could do almost anything in the account.
  4. In a real file, this line would contain a live API key written in plain text, readable by anyone who can see the file.
  5. The finished model is pushed to the registry without a signature, so nobody can later prove it was not swapped.

Why this is risky: each line is a separate way in. Together they let one mistake spread to every app that uses the model.

The safer way: use a safe file format and limit who can change the data. Run the job with a narrow role and fetch the key from a secrets manager. Sign the model before it reaches the registry.

How does it work?

A typical pipeline has five stages. Here is what can go wrong at each, and the basic protection.

  1. Collect and prepare data. If someone can change the data, they can change what the model learns. This is called data poisoning. Protect it with write access limits and records of where data came from [2].
  2. Bring in outside parts. Pre-trained models, code libraries and datasets often come from public sources. MITRE ATLAS lists the AI supply chain, including data, software and models, as a way attackers get in [3]. OWASP warns that third-party pre-trained models can be tampered with or poisoned [2].
  3. Train and test. Training jobs often run with powerful cloud accounts and keys. Keep their access narrow and their secrets out of code and notebooks.
  4. Store the model. The model artifact goes into a registry. Signing it lets later stages check it has not changed. The OpenSSF-linked model signing project signs a list of each model file's hash, and verification recomputes those hashes and compares them [4].
  5. Deploy and watch. Before deployment, verify the signature. After deployment, log who calls the model and watch for unusual behaviour, as the NCSC guidelines recommend for operation [1].
Diagram titled The MLOps pipeline and where it needs protecting. Five boxes in a row, joined by arrows: Data (collect and prepare), Outside parts (pre-trained models and libraries), Train and test, Model registry (store and sign), Deploy and monitor. Under each box is a red risk and a green protection: Data, risk poisoned data, protect with write limits and records of source; Outside parts, risk unsafe model files, protect with safe formats and trusted sources; Train, risk over-powered accounts and leaked keys, protect with narrow roles and a secrets manager; Registry, risk swapped model, protect with signing; Deploy, risk unnoticed misuse, protect with signature checks and logging. A bar along the bottom reads: every step runs as a non-human identity, so give each one an owner and least privilege.
Figure 1. Each stage of the pipeline has its own risk and its own basic protection.

One risk surprises many newcomers. Pickle, a common Python format for saving PyTorch model weights, can run code as soon as a file is loaded. Hugging Face advises against loading pickle files from untrusted sources. It lists the safetensors format as a safer alternative, which is designed to store only the weights [5]. Its Hub scans uploaded pickle files and highlights suspicious imports, but it says the scanner is not foolproof [5].

A worked example

This story is made up to show the idea.

Amara Ueda has just joined Quillfield Insurance as a junior ML engineer. Her first task is to fine-tune a public text model to sort customer emails.

She finds a promising model on a public hub. It is saved only in pickle format. Before loading it, she asks her mentor, Celia Marlow, whether that is fine.

Celia explains that loading a pickle file can run code. They look for the same model in safetensors format, find an official version from the original publisher, and use that instead.

Next, Amara looks at the team's training job settings. The job runs as a service account with admin rights, and a cloud key sits in a shared notebook. She raises both with Noor Quist, the team's security contact.

Noor moves the key into the secrets manager and revokes the old one. The training account gets a new role that can read only the training data and write only to the model registry. Noor also turns on model signing, so the deployment step refuses any model without a valid signature.

Two months later, a test model is pushed to the registry by mistake from a laptop. Deployment refuses it because it is unsigned. Amara learned that most MLOps security is ordinary care, applied at every stage.

Myths and mistakes

What people thinkWhat is true
A model file is just data, so it cannot hurt me.Some formats, such as pickle, can run code when loaded.[5]
If a hub scanned a file, it is safe.Hub scanners help, but they can miss things. Hugging Face says its scanner is not foolproof.[5]
A signature means the model is safe.A signature shows who published the files and that they have not changed. It does not prove the model itself is harmless.[5]
Security is only about the deployed model.The data, outside parts, training jobs and registry are all ways in.[3]
Training accounts need admin rights to work.Most jobs need only to read their data and write their outputs. Narrow roles limit damage if a job is hijacked.

What can I do this week?

  • Draw your team's pipeline on one page: where data comes from, where models are stored and where they are deployed.
  • Check one model you rely on. Is it in a safe format, and do you know who published it?
  • Search one notebook or settings file for keys written in plain text. See How to find secrets in Jupyter notebooks.
  • Find out which account your training jobs run as, and what that account can access.
  • Ask whether models are signed before they reach the registry.

Checklist

  • I can name the main stages of an MLOps pipeline.
  • I know that some model file formats can run code when loaded.
  • I prefer safe formats and trusted publishers for outside models.
  • I keep keys in a secrets manager, not in code or notebooks.
  • I check that pipeline accounts have only the access they need.
  • I know who can write to our training data.
  • I check that models are signed and verified before deployment.
  • I know where model calls are logged.

Common questions

What is the difference between MLOps and DevOps security?

Both protect automated pipelines. MLOps adds a few new things. Training data shapes how the model acts. Model files can carry code. And a model's flaws may not show up in normal tests. See DevSecOps for Beginners for the software side.

What is safetensors?

It is a file format for model weights. It is built to hold only the weights, so loading it should not run hidden code. Hugging Face, a popular model hub, recommends it in place of pickle [5].

What does signing a model do?

It records a fingerprint (hash) of each model file and signs that list. Anyone can later recompute the fingerprints and check they match, which shows the files have not changed since signing [4]. See the Model Signing and OpenSSF Model Signing Guide.

Why are pipeline accounts an identity problem?

Every automated step logs in to something as a service account, key or token. These non-human identities often have broad, long-lived access, so they are a prime target. Giving each one an owner, a narrow role and short-lived secrets reduces the risk.

Where should a small team start?

Start with safe model formats. Move keys into a secrets manager. Cut the training account down to the access it needs. Keep a record of which data and code built each model. Signing can come next.

Where next?

Ready for the detail? Read the practitioner guide: MLOps Security Guide. It covers pipeline controls, platform hardening and credentials in more depth.

Also useful:

Related NHI Mgmt Group resources: Non-Human Identities for Beginners, Secrets Management for Beginners and Jupyter Server Security Guide.

Key terms

MLOps
The practices and tools used to build, test, deploy and run machine learning models reliably.
Model registry
A store that holds model versions, their metadata and approval status.
Model artifact
The saved output of training, such as weights and configuration, that is stored and deployed.
Data poisoning
Deliberately corrupting training data so a model learns the wrong thing.
Model signing
Signing a model's files so others can check who published them and that they have not changed.
Non-human identity (NHI)
A digital identity used by software, such as a service account, API key or pipeline, rather than a person.

Sources and further reading

  1. National Cyber Security Centre, "Guidelines for secure AI system development", 27 November 2023. https://www.ncsc.gov.uk/collection/guidelines-secure-ai-system-development (accessed 30 Nov 2026).
  2. OWASP GenAI Security Project, "LLM03:2025 Supply Chain", OWASP Top 10 for LLM Applications 2025. https://genai.owasp.org/llmrisk/llm032025-supply-chain/ (accessed 30 Nov 2026).
  3. MITRE ATLAS, "AML.T0010 Supply Chain Compromise". https://atlas.mitre.org/techniques/AML.T0010 (accessed 30 Nov 2026).
  4. Sigstore, "model-transparency" (model signing), GitHub. https://github.com/sigstore/model-transparency (accessed 30 Nov 2026).
  5. Hugging Face, "Pickle Scanning", Hub documentation. https://huggingface.co/docs/hub/security-pickle (accessed 30 Nov 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.