# model-supply-chain-v1

> model-supply-chain-v1: 22 Keryn rules for python, typescript, javascript, dockerfile, yaml, json (6 error, 16 warning).

Source: https://keryn.dev/rules/model-supply-chain-v1/

22 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do not.

- **Confidence**: **P0** exploitable as written; **P1** dangerous in context; **P2** a heuristic or a posture check: confirm by reading the code.

- **False-positive risk**: **low**: an exact API or flag, so hits are almost always real; **medium**: the pattern is legitimate in many programs, so check each hit; **high**: it finds a lead to confirm, so expect benign hits.

- **Edge**: The relationship the finding sits on. **reaches**: content or traffic gets to a thing; **calls**: one thing invokes another; **reads**: one thing reads from another; **writes**: one thing writes to another; **sends**: data leaves for another party; **grants**: authority is given or left unchecked; **depends_on**: something relies on a component it does not verify; **trusts**: one party believes another without evidence. The boundary it crosses, when there is one: **user->prompt** (untrusted input reaching a prompt); **model->code** (model output reaching code, a shell, a query or a page); **secret->outside** (a secret leaving the trusted side); **supply-chain** (code, models or prompts pulled in from outside).

- **Taxonomy chips**: References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

## seceng.modelsc.hf-revision-mutable-ref

`warning` python huggingface, transformers

Hugging Face download pins `revision=` to a branch or tag name (e.g. "main"), which the repo owner can move at any time. Pin to the 40-character commit SHA instead.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-494](https://keryn.dev/taxonomies/cwe/#cwe-494-download-of-code-without-integrity-check) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Resolve the reviewed commit once (huggingface\_hub.HfApi().model\_info(repo).sha) and pass that 40-hex SHA as revision=. Record it in config, bump it deliberately, and prefer safetensors weights with trust\_remote\_code left off.

**References:** [https://huggingface.co/docs/huggingface_hub/guides/download](https://huggingface.co/docs/huggingface_hub/guides/download) · [https://huggingface.co/docs/transformers/main_classes/model](https://huggingface.co/docs/transformers/main_classes/model)

## seceng.modelsc.hf-from-pretrained-missing-revision

`warning` python huggingface, transformers

`from_pretrained` loads a Hub repo id with no `revision=`, so the weights resolve to whatever the default branch currently holds. Pin a reviewed 40-hex commit SHA.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Pass revision=&lt;40-hex commit SHA&gt; (and local\_files\_only=True in production once the snapshot is cached or baked into the image). Treat a repo-id literal without a pin as a floating dependency.

**References:** [https://huggingface.co/docs/huggingface_hub/guides/download](https://huggingface.co/docs/huggingface_hub/guides/download) · [https://huggingface.co/docs/transformers/main_classes/model](https://huggingface.co/docs/transformers/main_classes/model)

## seceng.modelsc.hf-hub-download-missing-revision

`warning` python huggingface

`hf_hub_download`/`snapshot_download` fetches a repo with no `revision=`; the artifact floats with the default branch. Pin a 40-hex commit SHA.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Pass revision=&lt;40-hex commit SHA&gt;. For fully offline deploys download once in CI, verify, and bake the snapshot into the image or artifact store.

**References:** [https://huggingface.co/docs/huggingface_hub/guides/download](https://huggingface.co/docs/huggingface_hub/guides/download)

## seceng.modelsc.hf-inference-client-user-model

`error` python data-flow rule huggingface, flask, fastapi

Request-controlled value selects the model for `huggingface_hub.InferenceClient`. The `model` argument also accepts a URL, so callers can steer traffic (and your token) to an arbitrary endpoint or an unreviewed model. Map user choices to an allow-list of model ids.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-918](https://keryn.dev/taxonomies/cwe/#cwe-918-server-side-request-forgery) [CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Never pass request data as model=. Keep a server-side dict of permitted model ids/endpoints, look the user's choice up in it, and reject unknown keys. Do not attach a Hub token to requests whose destination the caller can choose.

**References:** [https://huggingface.co/docs/huggingface_hub/guides/inference](https://huggingface.co/docs/huggingface_hub/guides/inference)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `api/generate.py` and scan it with `keryn scan api --verbose`; the finding below appears.

```python
from fastapi import FastAPI
from huggingface_hub import InferenceClient

app = FastAPI()

@app.post("/generate")
def generate(model: str, prompt: str):
    client = InferenceClient(model=model)
    return {"text": client.text_generation(prompt, max_new_tokens=128)}
```

Checked with Keryn's browser engine when this page was built: it reports `seceng.modelsc.hf-inference-client-user-model` at line 9 (error, proof 2). The rule's own logic is not published, so it cannot run in this tab; the pack list in the [playground](https://keryn.dev/playground/) shows what does.

## seceng.modelsc.transformers-user-controlled-model-id

`error` python data-flow rule huggingface, transformers, flask, fastapi

Request-controlled value is used as the Hugging Face model id (`pipeline`, `from_pretrained`, `hf_hub_download`, `snapshot_download`). An attacker can load any public repo, including one with pickled weights or custom code. Resolve ids through a server-side allow-list.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-502](https://keryn.dev/taxonomies/cwe/#cwe-502-deserialization-of-untrusted-data) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution)

**Fix:** Do not forward user input as a repo id or path. Look the choice up in a fixed mapping of reviewed models pinned by commit SHA, keep trust\_remote\_code off, and load safetensors only.

**References:** [https://huggingface.co/docs/transformers/main_classes/pipelines](https://huggingface.co/docs/transformers/main_classes/pipelines) · [https://huggingface.co/docs/hub/security-pickle](https://huggingface.co/docs/hub/security-pickle)

## seceng.modelsc.model-file-user-controlled-path

`error` python data-flow rule llama-cpp, gguf, safetensors, flask, fastapi

Request-controlled path reaches a local model loader (`llama_cpp.Llama`, `LlamaCpp`, `safetensors` load, `GGUFReader`). Callers can point the server at arbitrary files on disk or at attacker-supplied weights. Resolve a model name through an allow-list inside a fixed models directory.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-22](https://keryn.dev/taxonomies/cwe/#cwe-22-path-traversal) [CWE-73](https://keryn.dev/taxonomies/cwe/#cwe-73-external-control-of-file-name-or-path) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Accept a model key, not a path. Map it to a file under a fixed directory (resolve and verify the result stays inside it), and verify a pinned SHA-256 of the file before loading.

**References:** [https://llama-cpp-python.readthedocs.io/en/latest/api-reference/](https://llama-cpp-python.readthedocs.io/en/latest/api-reference/) · [https://huggingface.co/docs/safetensors/index](https://huggingface.co/docs/safetensors/index)

## seceng.modelsc.langsmith-pull-prompt-unpinned

`warning` python langsmith, langchain

`pull_prompt("name")` fetches the latest version of a LangSmith prompt. Anyone with write access to the prompt can change what your application sends to the model; pin `name:commit_hash`.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Pull by commit: client.pull\_prompt("owner/name:&lt;commit\_hash&gt;"). Promote new commits through review, and store the hash in configuration.

**References:** [https://docs.langchain.com/langsmith/manage-prompts-programmatically](https://docs.langchain.com/langsmith/manage-prompts-programmatically)

## seceng.modelsc.langchain-hub-pull-literal-unpinned

`warning` python langchain, langsmith

`hub.pull("owner/prompt")` has no `:commit` suffix, so the newest published prompt is used. A prompt edit upstream changes your agent's instructions without a code change; pin the commit hash.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Use hub.pull("owner/prompt:&lt;commit\_hash&gt;") and keep the hash in version control; review prompt diffs before bumping.

**References:** [https://docs.langchain.com/oss/python/langchain/overview](https://docs.langchain.com/oss/python/langchain/overview) · [https://docs.langchain.com/langsmith/manage-prompts-programmatically](https://docs.langchain.com/langsmith/manage-prompts-programmatically)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `agent/prompts.py` and scan it with `keryn scan agent --verbose`; the finding below appears.

```python
from langchain import hub
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="gpt-4o-mini")

def build_chain():
    prompt = hub.pull("acme-team/support-triage")
    return prompt | llm
```

Checked with Keryn's browser engine when this page was built: it reports `seceng.modelsc.langchain-hub-pull-literal-unpinned` at line 8 (warning, proof 0). The rule's own logic is not published, so it cannot run in this tab; the pack list in the [playground](https://keryn.dev/playground/) shows what does.

## seceng.modelsc.ollama-pull-latest-tag

`warning` python ollama

Ollama model is pulled as `latest` (explicitly or by omitting the tag). The tag is mutable, so a rebuilt image or a repulled model can silently change the weights. Pin an explicit tag, ideally a digest recorded at review time.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Pull `name:&lt;specific-tag&gt;` and record the resulting digest (ollama show --modelfile / /api/tags) in your deployment manifest; avoid pulling at request time.

**References:** [https://github.com/ollama/ollama/blob/main/docs/api.md#pull-a-model](https://github.com/ollama/ollama/blob/main/docs/api.md#pull-a-model) · [https://github.com/ollama/ollama-python](https://github.com/ollama/ollama-python)

## seceng.modelsc.ollama-pull-user-model

`error` python data-flow rule ollama, flask, fastapi

Request-controlled value names the model passed to Ollama's pull. Callers can make the server download arbitrary (including oversized or attacker-hosted `host/ns/model`) artifacts. Allow-list model names.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Pull only models from a server-side allow-list, pinned to a tag. Do not expose model management (pull/create/copy) to end users.

**References:** [https://github.com/ollama/ollama/blob/main/docs/api.md#pull-a-model](https://github.com/ollama/ollama/blob/main/docs/api.md#pull-a-model)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `api/models.py` and scan it with `keryn scan api --verbose`; the finding below appears.

```python
import ollama
from fastapi import FastAPI

app = FastAPI()

@app.post("/models/pull")
def pull_model(name: str):
    ollama.pull(name)
    return {"status": "pulled", "model": name}
```

Checked with Keryn's browser engine when this page was built: it reports `seceng.modelsc.ollama-pull-user-model` at line 9 (error, proof 2). The rule's own logic is not published, so it cannot run in this tab; the pack list in the [playground](https://keryn.dev/playground/) shows what does.

## seceng.modelsc.model-download-without-hash-check

`warning` python requests, gguf, llama-cpp

Model weights (`.gguf`, `.bin`, `.safetensors`, `.ckpt`, ...) are downloaded over HTTP in a function that never computes a digest. The file can be swapped upstream or in transit; verify a pinned SHA-256 before loading.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-494](https://keryn.dev/taxonomies/cwe/#cwe-494-download-of-code-without-integrity-check) [CWE-345](https://keryn.dev/taxonomies/cwe/#cwe-345-insufficient-verification-of-data-authenticity) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Hash the downloaded bytes with hashlib.sha256 and compare to a digest pinned in your repo (use hmac.compare\_digest) before writing to the model directory or loading.

**References:** [https://docs.python.org/3/library/hashlib.html](https://docs.python.org/3/library/hashlib.html) · [https://huggingface.co/docs/hub/security](https://huggingface.co/docs/hub/security)

## seceng.modelsc.mcp-stdio-npx-unpinned-python

`warning` python mcp, npm

MCP stdio server is launched via `npx -y &lt;package&gt;` (or `uvx`) with no version, so every start executes whatever the registry currently serves as that package. Pin `package@x.y.z` (or an integrity-checked local install).

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-494](https://keryn.dev/taxonomies/cwe/#cwe-494-download-of-code-without-integrity-check) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Pin the exact version (npx -y @scope/server@1.2.3, uvx pkg==1.2.3) or install it at build time from a lockfile and launch the local binary.

**References:** [https://modelcontextprotocol.io/specification/2026-07-28/basic/transports](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports) · [https://docs.npmjs.com/cli/commands/npx](https://docs.npmjs.com/cli/commands/npx)

## seceng.modelsc.langchainjs-hub-pull-unpinned

`warning` typescript, javascript langchain, langsmith

`hub.pull("owner/prompt")` (langchain/hub) has no `:commit` suffix, so the newest published prompt is used. Pin the commit hash.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Use hub.pull("owner/prompt:&lt;commit\_hash&gt;") and keep the hash in version control.

**References:** [https://docs.langchain.com/oss/javascript/langchain/overview](https://docs.langchain.com/oss/javascript/langchain/overview)

## seceng.modelsc.ollama-pull-user-model-ts

`error` typescript, javascript data-flow rule ollama, express, nextjs

Request-controlled value names the model passed to `ollama.pull`. Callers can make the server download arbitrary artifacts; allow-list model names and pin tags.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Pull only models from a server-side allow-list pinned to a tag; do not expose model management to end users.

**References:** [https://github.com/ollama/ollama-js#pull](https://github.com/ollama/ollama-js#pull)

## seceng.modelsc.transformersjs-user-controlled-model-id

`error` typescript, javascript data-flow rule transformers-js, huggingface, express, nextjs

Request-controlled value is the model id for Transformers.js `pipeline`/`from_pretrained`, letting callers load any Hub repo. Resolve ids through an allow-list.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [reaches](https://keryn.dev/docs/edges/edge-kinds/#reaches) content or traffic gets to a thing; it crosses the [`user->prompt`](https://keryn.dev/docs/edges/trust-boundaries/#user-to-prompt) boundary (untrusted input reaching a prompt).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Map user choices to a fixed list of reviewed model ids pinned with the `revision` option.

**References:** [https://huggingface.co/docs/transformers.js/api/pipelines](https://huggingface.co/docs/transformers.js/api/pipelines)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `server/embed.js` and scan it with `keryn scan server --verbose`; the finding below appears.

```js
import express from "express";
import { pipeline } from "@xenova/transformers";

const app = express();
app.use(express.json());

app.post("/embed", async (req, res) => {
  const modelId = req.body.model;
  const extractor = await pipeline("feature-extraction", modelId);
  const out = await extractor(req.body.text, { pooling: "mean" });
  res.json({ dims: out.dims });
});

app.listen(3000);
```

Checked with Keryn's browser engine when this page was built: it reports `seceng.modelsc.transformersjs-user-controlled-model-id` at line 9 (error, proof 2). The rule's own logic is not published, so it cannot run in this tab; the pack list in the [playground](https://keryn.dev/playground/) shows what does.

## seceng.modelsc.mcp-stdio-npx-unpinned-ts

`warning` typescript, javascript mcp, npm

MCP stdio server is launched via `npx -y &lt;package&gt;` with no version, so each start runs whatever the registry currently serves. Pin `package@x.y.z`.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-494](https://keryn.dev/taxonomies/cwe/#cwe-494-download-of-code-without-integrity-check) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Pin the exact version (npx -y @scope/server@1.2.3) or install from a lockfile at build time and run the local binary.

**References:** [https://modelcontextprotocol.io/specification/2026-07-28/basic/transports](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports) · [https://docs.npmjs.com/cli/commands/npx](https://docs.npmjs.com/cli/commands/npx)

## seceng.modelsc.dockerfile-ai-server-base-image-floating

`warning` dockerfile docker, vllm, ollama

Dockerfile base image for an AI serving stack (vLLM, Ollama, TGI, Open WebUI, LiteLLM) uses `:latest`/`:main`/`:nightly` or no tag. The build is not reproducible and an upstream push changes what you ship. Pin a version tag or digest.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-1357](https://keryn.dev/rules/?cwe=CWE-1357) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Use FROM image:&lt;version&gt;@sha256:&lt;digest&gt;; update via Renovate/Dependabot with review.

**References:** [https://docs.docker.com/build/building/best-practices/#pin-base-image-versions](https://docs.docker.com/build/building/best-practices/#pin-base-image-versions)

## seceng.modelsc.dockerfile-pip-unpinned-agent-framework

`warning` dockerfile docker, python, langchain, openai

`pip install` in a Dockerfile installs an LLM/agent framework with no version specifier. Each rebuild pulls whatever is newest (including a hijacked or breaking release). Pin `==` versions or install from a hashed lockfile.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-1357](https://keryn.dev/rules/?cwe=CWE-1357) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Install from a lockfile: pip install --require-hashes -r requirements.lock (pip-compile --generate-hashes / uv pip compile), or at minimum pin pkg==x.y.z.

**References:** [https://pip.pypa.io/en/stable/topics/secure-installs/](https://pip.pypa.io/en/stable/topics/secure-installs/)

## seceng.modelsc.dockerfile-npx-npm-global-unpinned-mcp

`warning` dockerfile docker, mcp, npm

Dockerfile runs an MCP server through `npx -y` or `npm install -g` without a version. The container fetches whatever the registry serves at build or start time. Pin `package@x.y.z`.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-494](https://keryn.dev/taxonomies/cwe/#cwe-494-download-of-code-without-integrity-check) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** npm install -g @scope/server@1.2.3 at build time (ideally from a lockfile with integrity hashes), then run the installed binary rather than npx -y.

**References:** [https://docs.npmjs.com/cli/commands/npm-install](https://docs.npmjs.com/cli/commands/npm-install) · [https://modelcontextprotocol.io/specification/2026-07-28/basic/transports](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports)

## seceng.modelsc.dockerfile-ollama-pull-latest

`warning` dockerfile docker, ollama

Dockerfile pulls an Ollama model with `latest` or no tag. The tag moves, so rebuilds ship different weights. Pin an explicit tag.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Use `ollama pull name:&lt;specific-tag&gt;` and record the digest in the image labels.

**References:** [https://docs.ollama.com/faq](https://docs.ollama.com/faq)

## seceng.modelsc.compose-ai-image-latest-or-untagged

`warning` yaml docker-compose, kubernetes, vllm, ollama, litellm

AI serving image (vLLM, Ollama, TGI, Open WebUI, LiteLLM) in compose/Kubernetes YAML uses `:latest`/`:main`/`:nightly` or no tag. Deployments are not reproducible and an upstream push changes the running code. Pin a version tag or digest.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-1357](https://keryn.dev/rules/?cwe=CWE-1357) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Reference image:&lt;version&gt;@sha256:&lt;digest&gt;. Update through a reviewed bump (Renovate/Dependabot).

**References:** [https://docs.docker.com/reference/compose-file/services/#image](https://docs.docker.com/reference/compose-file/services/#image) · [https://kubernetes.io/docs/concepts/containers/images/#image-names](https://kubernetes.io/docs/concepts/containers/images/#image-names)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `docker-compose.yml` and scan it with `keryn scan docker-compose.yml --verbose`; the finding below appears.

```yaml
services:
  llm:
    image: ollama/ollama:latest
    ports:
      - "11434:11434"
    volumes:
      - ollama-data:/root/.ollama
  app:
    build: .
    environment:
      OLLAMA_HOST: http://llm:11434
    depends_on:
      - llm

volumes:
  ollama-data: {}
```

Checked with Keryn's browser engine when this page was built: it reports `seceng.modelsc.compose-ai-image-latest-or-untagged` at line 3 (warning, proof 0). The rule's own logic is not published, so it cannot run in this tab; the pack list in the [playground](https://keryn.dev/playground/) shows what does.

## seceng.modelsc.package-json-script-npx-unpinned-mcp

`warning` json npm, mcp

package.json script runs an MCP server with `npx -y`/`npm i -g` and no version. Each run executes whatever the registry currently serves. Pin `package@x.y.z` or add it to devDependencies with a lockfile.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [depends_on](https://keryn.dev/docs/edges/edge-kinds/#depends-on) something relies on a component it does not verify; it crosses the [`supply-chain`](https://keryn.dev/docs/edges/trust-boundaries/#supply-chain) boundary (code, models or prompts pulled in from outside).

[CWE-829](https://keryn.dev/taxonomies/cwe/#cwe-829-inclusion-of-functionality-from-untrusted-control-sphere) [CWE-494](https://keryn.dev/taxonomies/cwe/#cwe-494-download-of-code-without-integrity-check) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Add the server to dependencies with an exact version, commit the lockfile, and invoke the local binary (npx --no-install server).

**References:** [https://docs.npmjs.com/cli/commands/npx](https://docs.npmjs.com/cli/commands/npx) · [https://modelcontextprotocol.io/specification/2026-07-28/basic/transports](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports)

**Try it: a snippet that triggers this rule**

Written for this page, not taken from any project. Save it as `package.json` and scan it with `keryn scan package.json --verbose`; the finding below appears.

```json
{
  "name": "docs-assistant",
  "version": "0.4.1",
  "private": true,
  "scripts": {
    "build": "tsc -p .",
    "mcp:files": "npx -y @modelcontextprotocol/server-filesystem ./docs",
    "start": "node dist/index.js"
  },
  "dependencies": {
    "zod": "3.23.8"
  }
}
```

Checked with Keryn's browser engine when this page was built: it reports `seceng.modelsc.package-json-script-npx-unpinned-mcp` at line 7 (warning, proof 1). The rule's own logic is not published, so it cannot run in this tab; the pack list in the [playground](https://keryn.dev/playground/) shows what does.
