# iac-ai-services-v1

> iac-ai-services-v1: 19 Keryn rules for hcl, yaml (7 error, 12 warning).

Source: https://keryn.dev/rules/iac-ai-services-v1/

19 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.iacai.bedrock-agent-iam-wildcard-action-resource

`error` hcl terraform, aws, bedrock

IAM policy grants `bedrock:*` (or `*` on a Bedrock/agent-named policy) on `Resource = "*"`. An agent role with this policy can invoke any model, edit agents/guardrails and read knowledge bases; a prompt-injected agent inherits all of it. Scope actions to the needed `bedrock:InvokeModel` ARNs and specific agent/guardrail/KB resources.

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

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-269](https://keryn.dev/rules/?cwe=CWE-269) [CWE-732](https://keryn.dev/rules/?cwe=CWE-732) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** List the specific actions (bedrock:InvokeModel, bedrock:Retrieve) and restrict Resource to the exact model, guardrail and knowledge-base ARNs. Add a permissions boundary and condition keys such as aws:SourceArn for the agent's service role.

**References:** [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrockagent_agent](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrockagent_agent) · [https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_service-with-iam.html](https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_service-with-iam.html)

## seceng.iacai.bedrock-agent-no-guardrail

`warning` hcl terraform, aws, bedrock

`aws_bedrockagent_agent` has no `guardrail_configuration`, so prompts and responses reach the model with no content, PII or prompt-attack filtering at the Bedrock layer. Attach an `aws_bedrock_guardrail` (with PROMPT\_ATTACK filtering) to the agent.

Confidence **P1**: dangerous in context. 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-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Add guardrail\_configuration &#123; guardrail\_identifier = aws\_bedrock\_guardrail.x.guardrail\_id  guardrail\_version = aws\_bedrock\_guardrail.x.version &#125; to the agent.

**References:** [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrockagent_agent#guardrail_configuration](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrockagent_agent#guardrail_configuration) · [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html)

## seceng.iacai.bedrock-guardrail-filter-strength-none

`warning` hcl terraform, aws, bedrock

`aws_bedrock_guardrail` content filter is set to strength `NONE`, which disables that filter for the direction. A PROMPT\_ATTACK filter at NONE removes the guardrail's injection defense entirely. Use at least MEDIUM (HIGH for PROMPT\_ATTACK input).

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

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

[CWE-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Set input\_strength and output\_strength to MEDIUM or HIGH for every filters\_config; PROMPT\_ATTACK uses input\_strength HIGH and output\_strength NONE (the only valid output value).

**References:** [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrock_guardrail](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrock_guardrail) · [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html)

## seceng.iacai.bedrock-guardrail-prompt-attack-none

`warning` hcl terraform, aws, bedrock

`aws_bedrock_guardrail` PROMPT\_ATTACK filter has `input_strength = "NONE"`, so jailbreak and prompt-injection detection is off. Use HIGH.

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

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

[CWE-1427](https://keryn.dev/taxonomies/cwe/#cwe-1427-improper-neutralization-of-input-used-for-llm-prompting) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack)

**Fix:** Set input\_strength = "HIGH" on the PROMPT\_ATTACK filter.

**References:** [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrock_guardrail](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/bedrock_guardrail) · [https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-prompt-attack.html)

## seceng.iacai.sagemaker-endpoint-config-no-kms

`warning` hcl terraform, aws, sagemaker

`aws_sagemaker_endpoint_configuration` has no `kms_key_arn`, so the endpoint's attached storage and captured inference payloads (prompts, completions) are encrypted only with an AWS-managed key you cannot control or audit. Set a customer-managed KMS key.

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-311](https://keryn.dev/rules/?cwe=CWE-311) [CWE-320](https://keryn.dev/rules/?cwe=CWE-320) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set kms\_key\_arn to a customer-managed key (and the same for data\_capture\_config.kms\_key\_id if capture is enabled).

**References:** [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sagemaker_endpoint_configuration#kms_key_arn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sagemaker_endpoint_configuration#kms_key_arn) · [https://raw.githubusercontent.com/hashicorp/terraform-provider-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown](https://raw.githubusercontent.com/hashicorp/terraform-provider-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown)

## seceng.iacai.sagemaker-notebook-direct-internet

`warning` hcl terraform, aws, sagemaker

`aws_sagemaker_notebook_instance` has `direct_internet_access = "Enabled"`, giving the notebook (which holds model artifacts and credentials) a path to and from the public internet outside your VPC controls. Set it to Disabled and route through a NAT/VPC endpoints.

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-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM03](https://keryn.dev/taxonomies/owasp-llm/#llm03-supply-chain) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set direct\_internet\_access = "Disabled", attach a subnet\_id, and reach package mirrors via VPC endpoints or a controlled egress path.

**References:** [https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sagemaker_notebook_instance#direct_internet_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sagemaker_notebook_instance#direct_internet_access) · [https://raw.githubusercontent.com/hashicorp/terraform-provider-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown](https://raw.githubusercontent.com/hashicorp/terraform-provider-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown)

## seceng.iacai.azure-openai-public-network-access-enabled

`error` hcl terraform, azure, azure-openai

`azurerm_cognitive_account` of kind OpenAI sets `public_network_access_enabled = true`, exposing the Azure OpenAI endpoint to the internet; only the API key stands between callers and your quota and data. Disable it and use private endpoints.

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-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Set public\_network\_access\_enabled = false and create an azurerm\_private\_endpoint for the account (subresource "account").

**References:** [https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#public_network_access_enabled](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#public_network_access_enabled) · [https://learn.microsoft.com/azure/ai-services/cognitive-services-virtual-networks](https://learn.microsoft.com/azure/ai-services/cognitive-services-virtual-networks)

## seceng.iacai.azure-openai-local-auth-enabled

`warning` hcl terraform, azure, azure-openai

`azurerm_cognitive_account` of kind OpenAI keeps `local_auth_enabled = true`, so long-lived API keys can call the endpoint and bypass Entra ID RBAC and conditional access. Disable local auth and authenticate with managed identities.

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-798](https://keryn.dev/taxonomies/cwe/#cwe-798-use-of-hard-coded-credentials) [CWE-287](https://keryn.dev/rules/?cwe=CWE-287) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Set local\_auth\_enabled = false and grant callers the Cognitive Services OpenAI User role via managed identity.

**References:** [https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#local_auth_enabled](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#local_auth_enabled) · [https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity](https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity)

## seceng.iacai.azure-openai-no-network-acls

`warning` hcl terraform, azure, azure-openai

`azurerm_cognitive_account` of kind OpenAI has no `network_acls` block, so with public access on (the default) any address can reach the endpoint. Add network\_acls with default\_action = "Deny" or disable public access.

Confidence **P1**: dangerous in context. 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-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Add network\_acls &#123; default\_action = "Deny" ip\_rules = [...] virtual\_network\_rules &#123;...&#125; &#125; or set public\_network\_access\_enabled = false with a private endpoint.

**References:** [https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#network_acls](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#network_acls) · [https://learn.microsoft.com/azure/ai-services/cognitive-services-virtual-networks](https://learn.microsoft.com/azure/ai-services/cognitive-services-virtual-networks)

## seceng.iacai.azure-openai-network-acls-default-allow

`error` hcl terraform, azure, azure-openai

`azurerm_cognitive_account` OpenAI `network_acls` uses `default_action = "Allow"`, which makes the ACL meaningless: every address not explicitly listed is still permitted. Use "Deny" and list the allowed ranges.

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

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

[CWE-1188](https://keryn.dev/rules/?cwe=CWE-1188) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Set default\_action = "Deny" and enumerate ip\_rules or virtual\_network\_rules.

**References:** [https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#network_acls](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account#network_acls)

## seceng.iacai.azure-openai-deployment-no-rai-policy

`warning` hcl terraform, azure, azure-openai

`azurerm_cognitive_deployment` sets no `rai_policy_name`, so the deployment uses the default content filter configuration and not one you reviewed. Attach an explicit Responsible AI (content filter) policy.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. 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-693](https://keryn.dev/rules/?cwe=CWE-693) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation)

**Fix:** Create an azurerm\_cognitive\_account\_rai\_policy with your filter levels (including Prompt Shields) and reference it via rai\_policy\_name.

**References:** [https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_deployment#rai_policy_name](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_deployment#rai_policy_name) · [https://learn.microsoft.com/azure/ai-services/openai/concepts/content-filter](https://learn.microsoft.com/azure/ai-services/openai/concepts/content-filter)

## seceng.iacai.vertex-ai-endpoint-no-private-network

`warning` hcl terraform, gcp, vertex-ai

`google_vertex_ai_endpoint` sets neither `network` nor `private_service_connect_config`, so predictions are served from a public endpoint. Use VPC peering or Private Service Connect for model endpoints that handle sensitive data.

Confidence **P1**: dangerous in context. 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-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Set network = "projects/&lt;num&gt;/global/networks/&lt;vpc&gt;" (peering) or private\_service\_connect\_config &#123; enable\_private\_service\_connect = true project\_allowlist = [...] &#125;.

**References:** [https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vertex_ai_endpoint#network](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vertex_ai_endpoint#network) · [https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/predictions/using-private-endpoints](https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/predictions/using-private-endpoints)

## seceng.iacai.gcp-ai-role-granted-to-public

`error` hcl terraform, gcp, vertex-ai, discovery-engine

Vertex AI / Discovery Engine (Vertex AI Search) role is granted to `allUsers` or `allAuthenticatedUsers`. Anyone on the internet (or with any Google account) can call your models, search apps and data stores on your bill. Grant to specific principals.

Confidence **P0**: exploitable as written. 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-732](https://keryn.dev/rules/?cwe=CWE-732) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Replace allUsers/allAuthenticatedUsers with named groups or service accounts, and enable the iam.allowedPolicyMemberDomains org policy to block public members.

**References:** [https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam) · [https://docs.cloud.google.com/iam/docs/principals-overview#all-users](https://docs.cloud.google.com/iam/docs/principals-overview#all-users) · [https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/discovery_engine_search_engine.html.markdown](https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/discovery_engine_search_engine.html.markdown)

## seceng.iacai.k8s-ai-service-exposed-loadbalancer-nodeport

`error` yaml kubernetes, vllm, ollama, litellm

Kubernetes Service for an AI model server (vLLM, Ollama, TGI, Open WebUI, LiteLLM, ...) is `type: LoadBalancer` or `NodePort`. These servers are unauthenticated by default (Ollama) or hold provider keys (LiteLLM, Open WebUI), so a public address hands out free inference and admin APIs. Keep it ClusterIP behind an authenticated gateway, or restrict with internal-LB annotations/loadBalancerSourceRanges.

Confidence **P1**: dangerous in context. 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) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Use type ClusterIP and publish only through an ingress/gateway that enforces authentication (OIDC proxy, API-key check), add NetworkPolicies, and if a cloud LB is needed mark it internal and set loadBalancerSourceRanges.

**References:** [https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) · [https://docs.ollama.com/faq#how-can-i-expose-ollama-on-my-network](https://docs.ollama.com/faq#how-can-i-expose-ollama-on-my-network)

## seceng.iacai.k8s-ai-ingress-no-auth-annotation

`warning` yaml kubernetes, ingress-nginx, vllm, ollama

Ingress routes to an AI model server (vLLM, Ollama, TGI, Open WebUI, LiteLLM, ...) but carries no authentication annotation (auth-url, auth-type/basic auth, oauth2-proxy, forward-auth, JWT). Verify the backend enforces auth itself; otherwise inference and admin endpoints are open to whoever can reach the ingress.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. 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-306](https://keryn.dev/taxonomies/cwe/#cwe-306-missing-authentication-for-critical-function) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Add external authentication (nginx.ingress.kubernetes.io/auth-url + auth-signin to an oauth2-proxy, or auth-type: basic with auth-secret), or front the service with an API gateway that validates keys/JWTs.

**References:** [https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#external-authentication](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#external-authentication)

## seceng.iacai.vllm-container-no-api-key

`warning` yaml vllm, kubernetes, docker-compose

vLLM OpenAI-compatible server container is started without `--api-key` (or `VLLM_API_KEY`), so anyone who can reach the port can run inference and use your GPUs. Set an API key from a Secret and still restrict network access.

Confidence **P1**: dangerous in context. 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) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Pass --api-key $(VLLM\_API\_KEY) (or set env VLLM\_API\_KEY from a Secret/secret file), keep the Service internal, and add a NetworkPolicy; use a gateway for per-user keys.

**References:** [https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html)

## seceng.iacai.ollama-bind-all-interfaces

`warning` yaml ollama, kubernetes, docker-compose

`OLLAMA_HOST` is set to `0.0.0.0`, binding Ollama's unauthenticated API (generate, pull, create, delete) on every interface. Make sure a NetworkPolicy/firewall limits who can reach port 11434, or put an authenticating proxy in front; this rule cannot see NetworkPolicy objects in other files.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. 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-306](https://keryn.dev/taxonomies/cwe/#cwe-306-missing-authentication-for-critical-function) [CWE-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI10](https://keryn.dev/taxonomies/owasp-agentic/#asi10-rogue-agents)

**Fix:** Bind to 127.0.0.1 or a pod-local sidecar, publish only through an authenticating reverse proxy, and apply a default-deny NetworkPolicy that admits only the calling workloads.

**References:** [https://docs.ollama.com/faq#how-can-i-expose-ollama-on-my-network](https://docs.ollama.com/faq#how-can-i-expose-ollama-on-my-network)

## seceng.iacai.gpu-ai-container-privileged

`error` yaml kubernetes, docker-compose, nvidia

GPU / model-serving container runs with `privileged: true`. A compromised model server or a prompt-injected tool gets full device and host access. GPUs are exposed through the NVIDIA device plugin/CDI without privileged mode; drop it.

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

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

[CWE-250](https://keryn.dev/taxonomies/cwe/#cwe-250-execution-with-unnecessary-privileges) [CWE-269](https://keryn.dev/rules/?cwe=CWE-269) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Remove privileged: true, request GPUs via resources.limits nvidia.com/gpu (or compose deploy.resources.reservations.devices), run as non-root and set allowPrivilegeEscalation: false with a restricted seccomp profile.

**References:** [https://kubernetes.io/docs/tasks/configure-pod-container/security-context/](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) · [https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/cdi-support.html](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/cdi-support.html)

## seceng.iacai.agent-tool-workload-host-network

`error` yaml kubernetes

Agent/tool/model workload runs with `hostNetwork: true`, putting its containers on the node's network namespace. A prompt-injected tool can then reach node-local services (kubelet, cloud metadata, other pods' host ports) and bypass NetworkPolicy. Use the pod network.

Confidence **P1**: dangerous in context. 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-668](https://keryn.dev/taxonomies/cwe/#cwe-668-exposure-of-resource-to-wrong-sphere) [CWE-250](https://keryn.dev/taxonomies/cwe/#cwe-250-execution-with-unnecessary-privileges) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse)

**Fix:** Remove hostNetwork (and hostPID/hostIPC); expose ports with a Service. Enforce the Pod Security 'baseline' or 'restricted' profile on the namespace.

**References:** [https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline](https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline)
