Introducing a new way to review your PRs.

Read the announcement

raroque / vibe-security-skill

Agent skill that audits vibe-coded apps for common security vulnerabilities introduced by AI coding assistants

View on GitHub

15 documents · Updated Oct 30, 2026

docs / ai-integration-security

AI integration security

AI integration security protects the boundary between an application, its users, and an external model provider. It guides reviews of model inputs, model outputs, provider credentials, usage limits, and any actions that model responses can cause.

Security boundary

The AI review applies the broader external integration security guidance to model providers. It also depends on data access security for permission checks and secrets and environment security for provider credentials.

Server-side provider access

The provider boundary must remain on the server. A client sends a request to the application, and the application uses its protected provider credential to call the model. This keeps the credential out of browser and mobile bundles, where users can extract it and consume the account.

This boundary also gives the application a place to enforce identity, permissions, usage limits, and input controls before it contacts the provider.

References: vibe-security/…/ai-integration.md• L3-11 vibe-security/SKILL.md• L24

Usage and cost controls

Model calls consume provider resources and can create direct cost. Provider spending caps are useful, but the application must also track usage per user or service tier and enforce daily or monthly limits before it sends a call.

The limits must be controlled by the server. A client-provided counter or plan value cannot protect the provider account because an attacker can change the request.

References: vibe-security/…/ai-integration.md• L13-24 vibe-security/SKILL.md• L30

Model input handling

Model input is an untrusted boundary. User messages and other data placed into a prompt can alter model behavior, reveal instructions, or influence later actions.

Prompt instruction separation

Prompt injection is an attempt to make user-controlled content override the application's instructions. Reviews should keep trusted system instructions separate from user messages and should not build a single trusted-looking instruction string by directly inserting raw user input.

Separation reduces confusion between instruction sources, but it does not remove the risk. High-stakes uses still need input checks and limits on what the model can do.

The input flow is therefore reviewed as a boundary before the provider call:

flowchart LR
    A[Client input] --> B[Server validation]
    B --> C[Separate trusted instructions and user content]
    C --> D[Model provider]

References: vibe-security/…/ai-integration.md• L26-44

Sensitive data exposure

Every value sent to a model provider becomes part of an external service interaction. The review must identify what user or application data enters the prompt and confirm that the integration has a valid need to send it.

Provider calls must not become an unplanned path for sensitive data. This check complements the repository's data access security guidance: permission to read data does not by itself mean permission to disclose it to a model provider.

References: vibe-security/…/ai-integration.md• L3-11 vibe-security/SKILL.md• L17

Model output handling

Model output is not a trusted system result. It can contain unsafe markup, executable content, or values that try to direct application behavior.

Output rendering

Applications must sanitize model text before rendering it as HTML. They must not execute model output as code unless the execution is isolated in a suitable sandbox.

The output boundary sits between the provider response and the user interface or downstream service. Treating the response as user-controlled data prevents the model from becoming an indirect script or code execution path.

References: vibe-security/…/ai-integration.md• L46-53

Tool and function permissions

Tools are application actions that a model can request, such as database queries, API calls, or file operations. A model request for a tool is not proof that the action is allowed.

The application must limit tools to a safe allowlist, validate each returned parameter against a schema, and use the least privilege needed for the action. Read-only access is preferred where it is sufficient. Tool calls must be logged so that sensitive or unexpected actions can be reviewed.

Raw SQL and shell commands must not be constructed from user input through model output. Any action that crosses a data or system boundary must still pass the same authorization checks that apply to a direct request.

References: vibe-security/…/ai-integration.md• L54-61 vibe-security/SKILL.md• L15-17

Provider interactions

The provider interaction combines credential protection, request controls, response checks, and cost controls. A secure review follows the full path rather than checking only the prompt or only the API key.

Request and response review

When the application processes a model request, review the sequence as a set of security gates:

  1. The server authenticates the caller and checks the caller's permitted data and capability.
  2. The server validates the input and keeps trusted instructions separate from user content.
  3. The server checks usage limits before calling the provider.
  4. The server sends only the data needed for the model task.
  5. The server treats the response as untrusted and validates it before display or action.
  6. The server records tool use when the model can invoke application capabilities.

This sequence connects AI-specific checks to the wider external integration security guidance. It also makes provider use observable and limits the effect of a compromised prompt or model response.

References: vibe-security/…/ai-integration.md• L11-24 vibe-security/…/ai-integration.md• L41-61 vibe-security/SKILL.md• L20-42

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to provider call paths must preserve the server-only credential boundary and the per-user usage checks.
  • Changes to prompt assembly must preserve the separation between trusted instructions and user content.
  • Changes that add model-driven tools must update the tool allowlist, parameter schema, least-privilege access, and audit record.
  • Changes that display or act on model output must keep output sanitization and validation at the new boundary.
  • Changes to data access must review whether newly available data can be sent to an external provider.

Important failure modes

TriggerConsequenceGuard
Provider key is placed in browser code or a mobile bundleAn attacker extracts it and uses the provider accountKeep all provider calls and keys on the server
The application relies only on provider spending limitsA burst of requests creates cost before provider limits take effectEnforce server-side per-user or per-tier daily and monthly limits
Raw user text is inserted into trusted prompt instructionsPrompt injection changes the model's behavior or instructionsKeep system and user messages separate and validate high-risk input
Model output is rendered as HTML without sanitizationScript content or event handlers reach the user interfaceSanitize output before HTML rendering
Model output is executed or passed to a tool without checksThe model triggers unsafe code, data access, or system actionsTreat output as untrusted; use allowlists, schemas, least privilege, and logs

Key files

FileWhy to read it
vibe-security/…/ai-integration.mdDefines the AI-specific review rules for keys, spending, prompt injection, output handling, and model tools.
vibe-security/SKILL.mdPlaces AI review in the full security audit and connects it to secrets, authorization, rate limits, and input validation.
vibe-security/…/openai.yamlShows the configured agent entry point that makes the security review skill available.