# cloudflare-workers-ai-v2

> cloudflare-workers-ai-v2: 8 Keryn rules for typescript, javascript (8 warning).

Source: https://keryn.dev/rules/cloudflare-workers-ai-v2/

8 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.cloudflare.worker-ai-no-auth

`warning` typescript, javascript cloudflare-workers

Cloudflare Worker performs AI, Vectorize, KV, D1, or R2 operation without visible auth/token/session check.

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: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-306](https://keryn.dev/taxonomies/cwe/#cwe-306-missing-authentication-for-critical-function) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

## seceng.cloudflare.ai-run-request-body-direct

`warning` typescript, javascript cloudflare-workers

Cloudflare Workers AI receives direct request body or query text without visible validation. This can enable prompt injection or abuse.

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: [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-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

## seceng.cloudflare.vectorize-query-without-namespace-filter

`warning` typescript, javascript cloudflare-workers

Cloudflare Vectorize query appears without namespace, tenant metadata filter, or user scoping.

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: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-639](https://keryn.dev/taxonomies/cwe/#cwe-639-authorization-bypass-through-user-controlled-key) [LLM08](https://keryn.dev/taxonomies/owasp-llm/#llm08-vector-and-embedding-weaknesses) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning)

## seceng.cloudflare-kv-ai-memory-without-tenant-prefix

`warning` typescript, javascript cloudflare-workers

Cloudflare KV stores or reads AI memory/chat/document data without visible tenant/user key prefix.

Confidence **P1**: dangerous in context. False-positive risk **high**: it finds a lead to confirm, so expect benign hits.

Edge inspected: [writes](https://keryn.dev/docs/edges/edge-kinds/#writes) one thing writes to another.

[CWE-639](https://keryn.dev/taxonomies/cwe/#cwe-639-authorization-bypass-through-user-controlled-key) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM08](https://keryn.dev/taxonomies/owasp-llm/#llm08-vector-and-embedding-weaknesses) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning)

## seceng.cloudflare-r2-public-ai-docs

`warning` typescript, javascript cloudflare-workers

Cloudflare R2 object path or public URL appears to expose AI documents, transcripts, embeddings, prompts, or model artifacts.

Confidence **P1**: dangerous in context. False-positive risk **high**: it finds a lead to confirm, so expect benign hits.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-200](https://keryn.dev/taxonomies/cwe/#cwe-200-exposure-of-sensitive-information-to-an-unauthorized-actor) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [LLM08](https://keryn.dev/taxonomies/owasp-llm/#llm08-vector-and-embedding-weaknesses) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

## seceng.cloudflare-d1-ai-query-without-tenant-filter

`warning` typescript, javascript cloudflare-workers

Cloudflare D1 query over AI/RAG/chat/memory data lacks visible tenant or user predicate.

Confidence **P1**: dangerous in context. False-positive risk **high**: it finds a lead to confirm, so expect benign hits.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-639](https://keryn.dev/taxonomies/cwe/#cwe-639-authorization-bypass-through-user-controlled-key) [LLM08](https://keryn.dev/taxonomies/owasp-llm/#llm08-vector-and-embedding-weaknesses) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning)

## seceng.cloudflare-worker-cors-wildcard-ai

`warning` typescript, javascript cloudflare-workers

Cloudflare Worker AI endpoint returns wildcard CORS headers.

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: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-346](https://keryn.dev/taxonomies/cwe/#cwe-346-origin-validation-error) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

## seceng.cloudflare-ai-gateway-logs-prompts

`warning` typescript, javascript cloudflare-workers

Cloudflare AI Gateway or analytics config appears to log prompts, messages, or completions.

Confidence **P1**: dangerous in context. False-positive risk **high**: it finds a lead to confirm, so expect benign hits.

Edge inspected: [sends](https://keryn.dev/docs/edges/edge-kinds/#sends) data leaves for another party; it crosses the [`secret->outside`](https://keryn.dev/docs/edges/trust-boundaries/#secret-to-outside) boundary (a secret leaving the trusted side).

[CWE-532](https://keryn.dev/taxonomies/cwe/#cwe-532-insertion-of-sensitive-information-into-log-file) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure)
