Skip to main content

SKY-D263 · Security in code

Secrets or personal data sent to an LLM

Text sent to a hosted model leaves your system: the provider receives it, may log it, and the model may repeat it to whoever reads the answer. SKY-D263 reports a model or embedding call whose input contains a value that looks secret or personal, such as an API key, a password, a token or an environment variable.

Languages
Python
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
Sensitive data sent to LLM
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

A debugging helper that pastes the app's settings into a prompt hands a live payment key to a third party and puts it in their logs. If the answer is shown to users or stored, the key can surface there as well.

What Skylos flags

ops/explain.py · PythonReported on line 13
import os from openai import OpenAI client = OpenAI()  def explain_failure(error: str) -> str:    settings = {        "database_url": os.environ["DATABASE_URL"],        "stripe_api_key": os.environ["STRIPE_API_KEY"],    }    reply = client.responses.create(        model="gpt-4o-mini",        input=f"Why does this fail?\n{error}\nSettings: {settings}",    )    return reply.output_text

What Skylos leaves alone

ops/explain.py · Python
import os from openai import OpenAI from ops.logs import redact_secrets client = OpenAI()  def explain_failure(error: str) -> str:    settings = {        "database_url": os.environ["DATABASE_URL"],        "stripe_api_key": os.environ["STRIPE_API_KEY"],    }    reply = client.responses.create(        model="gpt-4o-mini",        input=f"Why does this fail?\n{error}\nSettings: {redact_secrets(settings)}",    )    return reply.output_text

Why Skylos leaves it alone

The same settings pass through redact_secrets() first. A call whose name is redact, mask, redact_secrets, redact_pii or sanitize_for_llm counts as cleaning the value. Skylos trusts the name and does not read the function.

How Skylos decides

  1. Runs with --danger on Python files that mention an LLM library, and finds the same model calls and prompt arguments as SKY-D261, including .embeddings.create.
  2. Reports HIGH when the prompt contains a sensitive value: a variable, attribute, dictionary key or subscript whose name contains password, secret, token, auth, credential, api_key, apikey, private_key, ssn or credit_card; any os.environ[...] value or os.environ itself; or os.getenv() / os.environ.get() of a name containing KEY, TOKEN, SECRET, PASSWORD, AUTH or CREDENTIAL (or of a name that is not a literal).
  3. Follows values through f-strings, +, lists, dictionaries, call arguments and variables assigned in the same function.
  4. A call named redact, mask, redact_secrets, redact_pii or sanitize_for_llm around the value stops it from counting.

How to fix it

Send the model only what it needs to answer. Here that is the error and which settings are present, never their values. If values must go, remove secrets and personal data first with a redaction step you have tested.

ops/explain.py · Python · the fix, against the flagged file
import os from openai import OpenAI client = OpenAI()Added: SETTING_NAMES = ("DATABASE_URL", "STRIPE_API_KEY")  def explain_failure(error: str) -> str:Removed:     settings = {Removed:         "database_url": os.environ["DATABASE_URL"],Removed:         "stripe_api_key": os.environ["STRIPE_API_KEY"],Removed:     }Added:     present = [name for name in SETTING_NAMES if name in os.environ]    reply = client.responses.create(        model="gpt-4o-mini",Removed:         input=f"Why does this fail?\n{error}\nSettings: {settings}",Added:         input=f"Why does this fail?\n{error}\nSettings that are set: {present}",    )    return reply.output_text

When it can be wrong

  • Name parts match anywhere in a name: author contains auth, so a prompt that includes a variable called author is reported. Any os.environ[...] value counts, even a harmless one such as a region name.
  • Missed: personal data in fields with other names (email, phone, address), secrets read from a file or a vault client, values built in another function, and code in other languages.
  • Any function called mask or redact clears the value, even one that does nothing.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Put the marker on the line where the model call starts.

    Python
    reply = client.responses.create(  # skylos: ignore[SKY-D263] local model, no egress
  • skylos baseline ., then --baseline, accepts reviewed calls and reports new ones.

  • [tool.skylos] ignore = ["SKY-D263"] turns the rule off for the whole project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.