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
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
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_textWhat Skylos leaves alone
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_textWhy 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
- Runs with
--dangeron Python files that mention an LLM library, and finds the same model calls and prompt arguments as SKY-D261, including.embeddings.create. - 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,ssnorcredit_card; anyos.environ[...]value oros.environitself; oros.getenv()/os.environ.get()of a name containingKEY,TOKEN,SECRET,PASSWORD,AUTHorCREDENTIAL(or of a name that is not a literal). - Follows values through f-strings,
+, lists, dictionaries, call arguments and variables assigned in the same function. - A call named
redact,mask,redact_secrets,redact_piiorsanitize_for_llmaround 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.
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_textWhen it can be wrong
- Name parts match anywhere in a name:
authorcontainsauth, so a prompt that includes a variable calledauthoris reported. Anyos.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
maskorredactclears 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 egressskylos baseline ., then--baseline, accepts reviewed calls and reports new ones.[tool.skylos] ignore = ["SKY-D263"]turns the rule off for the whole project.