Fix guide · medium · llm_prompt_template_in_client

LLM system-prompt template shipped in client code

What this rule means

A long string literal containing LLM-shape markers ("you are an AI", "ignore previous instructions", numbered guidelines) was found in your bundle.

Why it matters

Two problems. (1) The prompt itself is exposed — attackers can craft jailbreaks targeting it specifically. (2) It strongly suggests the LLM call is made from the browser, which means the LLM API key is also in the bundle. Search for openai_key or anthropic_key findings; usually they pair.

How to fix it

  1. Move the LLM call server-side. Pattern: client → your API → OpenAI/Anthropic. The prompt template lives on your server. The user's input flows through your server, which adds the system prompt and forwards the call.
  2. If you must keep the call client-side (truly), keep the prompt template short and assume it's reverse-engineerable. Don't include "secret" instructions you'd be embarrassed about.
  3. Add prompt-injection defenses — refuse to follow instructions in the user's input, validate the LLM's response shape before returning to the user.

Did vibecheck flag this on your app?

If you reached this page from a vibecheck inspection report, the redacted match in your scan output is the exact string we found in your bundle. After applying the fix above, run the inspection again — the finding should clear.

Run another inspection