Skip to content

    Type a page, a command such as keryn scan, or a rule id.

    vendor-sdk-safety-controls-v1

    View as Markdown

    10 rules · Keryn Software Licence · rules 0.8.0 · all packs

    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

    Section titled “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 one party believes another without evidence.

    CWE-1188 LLM01 LLM05

    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/reference/resources/moderations

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

    Section titled “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 one party believes another without evidence.

    CWE-1188 LLM01 LLM05

    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/reference/resources/moderations

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

    Section titled “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 one party believes another without evidence.

    CWE-754 LLM05

    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://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml

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

    Section titled “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 one party believes another without evidence.

    CWE-754 LLM05

    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://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml

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

    Section titled “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 authority is given or left unchecked.

    CWE-862 LLM06

    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

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

    Section titled “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 one party believes another without evidence.

    CWE-1188 LLM05

    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://raw.githubusercontent.com/googleapis/python-genai/main/google/genai/types.py

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

    Section titled “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 one party believes another without evidence.

    CWE-1188 LLM05

    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://raw.githubusercontent.com/googleapis/python-genai/main/google/genai/types.py

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

    Section titled “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 { kms_key_name = … } 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 one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).

    CWE-311 LLM02

    Fix: Add encryption_spec { kms_key_name = google_kms_crypto_key.<key>.id } 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://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-aws/main/website/docs/r/sagemaker_endpoint_configuration.html.markdown

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

    Section titled “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 content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-668 LLM02

    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://docs.cloud.google.com/gemini-enterprise-agent-platform/notebooks/workbench/instances/create

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

    Section titled “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 content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-668 LLM02

    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://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