Checklists

Security for AI Apps implementation checklist

This checklist outlines the technical verification steps required to secure LLM-integrated applications against prompt injection, data leakage, and infrastructure vulnerabilities before moving to a production environment.

Progress0 / 25 complete (0%)

Prompt Injection Mitigation

0/5
  • Implement Delimiter Separation

    critical

    Enclose user input within distinct delimiters (e.g., triple quotes or XML tags) in the prompt template to help the LLM distinguish between developer instructions and user-provided data.

  • Deploy an Injection Detection Layer

    critical

    Integrate a dedicated security tool like Rebuff or a secondary 'judge' LLM to analyze incoming user prompts for known injection patterns before they reach the primary model.

  • Enforce Input Schema Validation

    critical

    Use Zod or Pydantic to strictly validate the structure, type, and length of user inputs to prevent unexpected payloads from being processed by the LLM.

  • Apply Least-Privilege System Instructions

    recommended

    Audit the system prompt to ensure it explicitly instructs the model to ignore any user commands that attempt to override its core security constraints or access internal tools.

  • Test Against Indirect Injection

    critical

    Verify that data fetched from third-party APIs or external websites is treated as untrusted user input and passed through the same sanitization pipeline as direct user prompts.

Data Privacy and PII Protection

0/5
  • Implement Pre-Inference PII Scrubbing

    critical

    Use a library like Microsoft Presidio or LLM Guard to identify and redact Personally Identifiable Information (PII) from user prompts before they are sent to external LLM providers.

  • Disable Provider Data Training

    critical

    Verify in the LLM provider's settings (e.g., OpenAI Enterprise or Azure OpenAI) that user data is not utilized for model training or retained beyond the required retention period.

  • Audit Few-Shot Prompt Context

    critical

    Scan the hardcoded examples in your prompt templates to ensure no production secrets, internal database schemas, or sensitive employee data are included as context.

  • Validate Data Localization Compliance

    recommended

    Confirm that the LLM provider's data center region aligns with your organization's residency requirements (e.g., GDPR data processing within the EU).

  • Encrypt Data in Transit and Rest

    critical

    Ensure all communication with LLM APIs occurs over TLS 1.3 and that any locally cached prompt history is encrypted using AES-256.

Output Guardrails and Moderation

0/5
  • Enable Native Moderation APIs

    critical

    Pipe all LLM generated content through a moderation endpoint (e.g., OpenAI Moderation API) to block responses containing hate speech, self-harm, or illegal content.

  • Verify Output Structural Integrity

    recommended

    Use Guardrails AI or NeMo Guardrails to validate that the LLM output conforms to the expected JSON schema or code format before it is parsed by the application.

  • Filter Sensitive Information Leakage

    recommended

    Implement regex-based scanners on the LLM output to detect and block the accidental disclosure of internal IP addresses, API keys, or proprietary internal terminology.

  • Set Token Response Limits

    recommended

    Configure a strict 'max_tokens' parameter on all inference calls to prevent resource exhaustion and mitigate potential Denial of Wallet attacks via excessively long responses.

  • Sanitize Output for XSS

    critical

    Apply standard HTML escaping to LLM-generated text before rendering it in a web UI to prevent the execution of malicious scripts injected via the model output.

Infrastructure and Secret Management

0/5
  • Centralize API Key Storage

    critical

    Move LLM provider API keys from environment variables into a managed secret store like AWS Secrets Manager, HashiCorp Vault, or Azure Key Vault.

  • Implement User-Level Rate Limiting

    critical

    Apply rate limits based on the authenticated user ID rather than IP address to prevent a single compromised account from draining your LLM API credits.

  • Rotate Production API Credentials

    recommended

    Establish an automated rotation policy for all LLM service keys and verify that legacy keys are immediately revoked upon rotation.

  • Use IAM Roles for Cloud LLMs

    critical

    When using services like AWS Bedrock or Vertex AI, utilize IAM roles and service accounts instead of static access keys to follow the principle of least privilege.

  • Isolate AI Microservices

    recommended

    Deploy LLM-handling logic in an isolated network segment (VPC) with restricted egress to only the specific domains required by the LLM providers.

Monitoring and Incident Response

0/5
  • Log Inference Metadata

    critical

    Record prompt/response pairs, token usage, and latency in a secure, centralized logging system (e.g., Datadog, ELK) while ensuring PII is masked in the logs.

  • Alert on High Refusal Rates

    recommended

    Configure monitoring alerts for when the LLM or moderation layer returns a high frequency of 'safety-related' refusals, which may indicate an active injection attempt.

  • Establish an Emergency Kill Switch

    critical

    Implement a feature flag or configuration toggle that can instantly disable LLM functionality across the application without requiring a full code redeploy.

  • Perform Red-Teaming Exercises

    recommended

    Conduct a scheduled 'jailbreak' test where security engineers attempt to bypass current guardrails using techniques from the OWASP LLM Top 10.

  • Monitor Token Usage Anomalies

    recommended

    Set up automated alerts for token consumption spikes that exceed the 95th percentile of historical usage to detect automated abuse or recursive loop bugs.