# vendor-sdk-safety-controls-v1

> vendor-sdk-safety-controls-v1: 10 Keryn rules for python, javascript, typescript, yaml, hcl (10 warning).

Source: https://keryn.dev/rules/vendor-sdk-safety-controls-v1/

10 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.

## keryn.vendor.openai-call-without-moderation-py

`warning` python openai

The function that calls this OpenAI generation endpoint never calls moderations.create, so harmful or policy-violating input and output reach the model and your users unscreened. The Moderation endpoint is free; screen user input before the call and model output before it is shown.

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: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-1188](https://keryn.dev/rules/?cwe=CWE-1188) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Call client.moderations.create(input=...) on the user input before this call and on the generated text before returning it, and refuse or fall back when the result is flagged. If moderation runs in shared middleware, suppress this audit there.

**References:** [https://developers.openai.com/api/docs/guides/safety-best-practices](https://developers.openai.com/api/docs/guides/safety-best-practices) · [https://developers.openai.com/api/reference/resources/moderations](https://developers.openai.com/api/reference/resources/moderations)

## keryn.vendor.openai-call-without-moderation-js

`warning` javascript, typescript openai

The function that calls this OpenAI generation endpoint never calls moderations.create, so harmful or policy-violating input and output reach the model and your users unscreened. The Moderation endpoint is free; screen user input before the call and model output before it is shown.

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: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-1188](https://keryn.dev/rules/?cwe=CWE-1188) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Call client.moderations.create(input=...) on the user input before this call and on the generated text before returning it, and refuse or fall back when the result is flagged. If moderation runs in shared middleware, suppress this audit there.

**References:** [https://developers.openai.com/api/docs/guides/safety-best-practices](https://developers.openai.com/api/docs/guides/safety-best-practices) · [https://developers.openai.com/api/reference/resources/moderations](https://developers.openai.com/api/reference/resources/moderations)

## keryn.vendor.openai-moderation-result-flagged-unchecked-py

`warning` python openai

The moderation result is read for categories or category\_scores but results[0].flagged is never consulted in this function. The per-category booleans come from OpenAI's thresholds and scores need a cut-off you chose; skipping the top-level flagged verdict usually means nothing is blocked. Branch on results[0].flagged (and on your own score cut-offs if you use them).

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: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-754](https://keryn.dev/rules/?cwe=CWE-754) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Read result.results[0].flagged first and block or route to review when it is true; treat categories and category\_scores as detail for logging or for stricter per-category limits.

**References:** [https://developers.openai.com/api/reference/resources/moderations](https://developers.openai.com/api/reference/resources/moderations) · [https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml](https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml)

## keryn.vendor.openai-moderation-result-flagged-unchecked-js

`warning` javascript, typescript openai

The moderation result is read for categories or category\_scores but results[0].flagged is never consulted in this function. The per-category booleans come from OpenAI's thresholds and scores need a cut-off you chose; skipping the top-level flagged verdict usually means nothing is blocked. Branch on results[0].flagged (and on your own score cut-offs if you use them).

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: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-754](https://keryn.dev/rules/?cwe=CWE-754) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Read result.results[0].flagged first and block or route to review when it is true; treat categories and category\_scores as detail for logging or for stricter per-category limits.

**References:** [https://developers.openai.com/api/reference/resources/moderations](https://developers.openai.com/api/reference/resources/moderations) · [https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml](https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml)

## keryn.vendor.openai-action-mutating-op-not-consequential-yaml

`warning` yaml openai, gpt-actions

A GPT Actions OpenAPI operation that changes state (post, put, patch or delete) sets x-openai-isConsequential to false. ChatGPT then offers an always-allow option and runs it without per-call confirmation, so a prompt-injected conversation can write, send or delete through your API. Set it to true for any operation with side effects.

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-862](https://keryn.dev/taxonomies/cwe/#cwe-862-missing-authorization) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency)

**Fix:** Remove the flag or set x-openai-isConsequential: true on every operation that creates, updates, deletes or sends something; keep false for pure reads.

**References:** [https://developers.openai.com/api/docs/actions/production](https://developers.openai.com/api/docs/actions/production) · [https://developers.openai.com/api/docs/actions/production](https://developers.openai.com/api/docs/actions/production)

## keryn.vendor.gemini-safety-threshold-block-none-py

`warning` python gemini, google-genai

A Gemini safety setting turns the harm filter off for a category (BLOCK\_NONE or OFF). The model will then return sexual, harassing, hateful or dangerous content that your application relays to users. Raise the threshold to BLOCK\_MEDIUM\_AND\_ABOVE or stricter, and relax a category only with a documented product reason and your own output filter.

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

Edge inspected: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-1188](https://keryn.dev/rules/?cwe=CWE-1188) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Use a threshold of BLOCK\_MEDIUM\_AND\_ABOVE or stricter for every harm category, keep the list in one shared module, and layer your own moderation on output for any category that must stay relaxed.

**References:** [https://ai.google.dev/gemini-api/docs/safety-settings](https://ai.google.dev/gemini-api/docs/safety-settings) · [https://raw.githubusercontent.com/googleapis/python-genai/main/google/genai/types.py](https://raw.githubusercontent.com/googleapis/python-genai/main/google/genai/types.py)

## keryn.vendor.gemini-safety-threshold-block-none-js

`warning` javascript, typescript gemini, google-genai

A Gemini safety setting turns the harm filter off for a category (BLOCK\_NONE or OFF). The model will then return sexual, harassing, hateful or dangerous content that your application relays to users. Raise the threshold to BLOCK\_MEDIUM\_AND\_ABOVE or stricter, and relax a category only with a documented product reason and your own output filter.

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

Edge inspected: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-1188](https://keryn.dev/rules/?cwe=CWE-1188) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling)

**Fix:** Use a threshold of BLOCK\_MEDIUM\_AND\_ABOVE or stricter for every harm category, keep the list in one shared module, and layer your own moderation on output for any category that must stay relaxed.

**References:** [https://ai.google.dev/gemini-api/docs/safety-settings](https://ai.google.dev/gemini-api/docs/safety-settings) · [https://raw.githubusercontent.com/googleapis/python-genai/main/google/genai/types.py](https://raw.githubusercontent.com/googleapis/python-genai/main/google/genai/types.py)

## keryn.vendor.vertex-ai-resource-without-cmek-tf

`warning` hcl terraform, gcp, vertex-ai

This Vertex AI resource has no encryption\_spec block, so its data (training data, features, metadata, index or endpoint payloads) is encrypted only with a Google-managed key. Set encryption\_spec &#123; kms\_key\_name = ... &#125; so your organisation controls key rotation and revocation.

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

**Fix:** Add encryption\_spec &#123; kms\_key\_name = google\_kms\_crypto\_key.&lt;key&gt;.id &#125; and grant the Vertex AI service agent roles/cloudkms.cryptoKeyEncrypterDecrypter on that key. The key must be in the same region as the resource.

**References:** [https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vertex_ai_dataset#encryption_spec](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vertex_ai_dataset#encryption_spec) · [https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/general/cmek](https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/general/cmek) · [https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/vertex_ai_featurestore.html.markdown](https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/vertex_ai_featurestore.html.markdown) · [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)

## keryn.vendor.notebooks-instance-public-ip-tf

`warning` hcl terraform, gcp, vertex-ai

This google\_notebooks\_instance does not set no\_public\_ip = true, so the notebook VM gets an external IP. Notebooks hold credentials, datasets and model artifacts; keep them off the public internet and reach them through IAP or a private network.

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-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)

**Fix:** Set no\_public\_ip = true together with network and subnet, and use Cloud NAT or Private Google Access for egress.

**References:** [https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/notebooks_instance#no_public_ip](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/notebooks_instance#no_public_ip) · [https://docs.cloud.google.com/gemini-enterprise-agent-platform/notebooks/workbench/instances/create](https://docs.cloud.google.com/gemini-enterprise-agent-platform/notebooks/workbench/instances/create)

## keryn.vendor.workbench-instance-public-ip-tf

`warning` hcl terraform, gcp, vertex-ai

This google\_workbench\_instance does not set gce\_setup.disable\_public\_ip = true, so the Workbench VM gets an external IP. Workbench instances hold credentials, datasets and model artifacts; keep them off the public internet and use IAP or a private network.

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-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)

**Fix:** Inside gce\_setup set disable\_public\_ip = true and attach the instance to a private subnetwork with Cloud NAT or Private Google Access.

**References:** [https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/workbench_instance#disable_public_ip](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/workbench_instance#disable_public_ip) · [https://docs.cloud.google.com/gemini-enterprise-agent-platform/notebooks/workbench/instances/create](https://docs.cloud.google.com/gemini-enterprise-agent-platform/notebooks/workbench/instances/create) · [https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/workbench_instance.html.markdown](https://raw.githubusercontent.com/hashicorp/terraform-provider-google/main/website/docs/r/workbench_instance.html.markdown)
