Перейти к содержанию
Skillpedia
Агенты48k · #5077

llm-app-security

Что он делает

Этот инструмент помогает защитить приложения на основе ИИ от атак и злоупотреблений. Он проверяет то, что вводит пользователь, и контролирует ответы ИИ, чтобы ИИ нельзя было обмануть или заставить раскрыть информацию.

Когда использовать

  • ✓Когда вы создаёте чат-бота для службы поддержки.
  • ✓Когда вы встраиваете ИИ в программный продукт.
  • ✓Когда вы используете ИИ для обработки конфиденциальной информации.

Ссылка на скилл

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/llm-app-security/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/llm-app-security/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Защити моё приложение на основе ИИ от атак.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Инструмент проверяет, что пользователь написал, чтобы убедиться, что это не вредоносный запрос и не попытка обмануть ИИ. Также он контролирует ответы ИИ, чтобы тот не раскрыл конфиденциальные данные.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

LLM Application Security

Harden chatbots, RAG pipelines, and AI features embedded in SaaS products against prompt injection, data leakage, abuse, and compliance violations.


OWASP LLM Top 10 -- Risk Map and Mitigations

The OWASP Top 10 for LLM Applications (2025) defines the most critical risks. The table below maps each risk to concrete controls implemented later in this document.

# Risk Key Mitigation Section
LLM01 Prompt Injection Input validation, instruction hierarchy Input Validation, System Prompt Protection
LLM02 Insecure Output Handling Output sanitization, PII scrubbing Output Safety
LLM03 Training Data Poisoning Document ingestion scanning Secure RAG Pipeline
LLM04 Model Denial of Service Per-user token budgets, rate limiting Rate Limiting
LLM05 Supply Chain Vulnerabilities Pin model versions, verify checksums Compliance
LLM06 Sensitive Information Disclosure PII detection, tenant isolation Output Safety, Tenant Isolation
LLM07 Insecure Plugin Design Tool allowlists, parameter validation System Prompt Protection
LLM08 Excessive Agency Least-privilege tool scopes System Prompt Protection
LLM09 Overreliance Provenance tracking, confidence scores Secure RAG Pipeline
LLM10 Model Theft Access controls, API key rotation Rate Limiting, Compliance

Input Validation

Every user message must be validated before it reaches the LLM. Validation has three layers: structural checks, injection detection, and content moderation.

Structural Checks (Python)

import re
from dataclasses import dataclass

@dataclass
class InputPolicy:
    max_length: int = 4096
    max_lines: int = 50
    allowed_languages: set = None  # None = all

    def __post_init__(self):
        if self.allowed_languages is None:
            self.allowed_languages = {"en"}

def validate_structure(text: str, policy: InputPolicy) -> tuple[bool, str]:
    """Return (is_valid, reason)."""
    if not text or not text.strip():
        return False, "empty_input"
    if len(text) > policy.max_length:
        return False, f"exceeds_max_length_{policy.max_length}"
    if text.count("\n") > policy.max_lines:
        return False, f"exceeds_max_lines_{policy.max_lines}"
    # Block null bytes and control characters (except newline/tab)
    if re.search(r"[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]", text):
        return False, "contains_control_characters"
    return True, "ok"

Prompt Injection Detection (Python)

import re
from typing import Optional

# Patterns that signal an attempt to override system instructions
INJECTION_PATTERNS = [
    # Direct instruction override
    r"(?i)ignore\s+(all\s+)?(previous|prior|above)\s+(instructions?|prompts?|rules?)",
    r"(?i)disregard\s+(all\s+)?(previous|prior|above)\s+(instructions?|prompts?)",
    # System prompt extraction
    r"(?i)(reveal|show|print|output|repeat)\s+(your\s+)?(system\s+prompt|instructions|rules)",
    r"(?i)what\s+(are|were)\s+your\s+(initial\s+)?(instructions|rules|prompt)",
    # Role override
    r"(?i)you\s+are\s+now\s+(a|an|the)\s+",
    r"(?i)(act|behave|respond)\s+as\s+(if\s+)?(you\s+)?(are|were)\s+",
    # Delimiter injection
    r"(?i)<\/?system>",
    r"(?i)\[INST\]|\[\/INST\]",
    r"(?i)###\s*(system|instruction|human|assistant)",
    # Encoding evasion (base64 instructions)
    r"(?i)decode\s+(the\s+)?following\s+(base64|hex|rot13)",
]

_compiled = [re.compile(p) for p in INJECTION_PATTERNS]

def detect_injection(text: str) -> Optional[str]:
    """Return the matched pattern name if injection is detected, else None."""
    for pattern in _compiled:
        match = pattern.search(text)
        if match:
            return pattern.pattern
    return None

Prompt Injection Detection (Node.js)

const INJECTION_PATTERNS = [
  /ignore\s+(all\s+)?(previous|prior|above)\s+(instructions?|prompts?|rules?)/i,
  /disregard\s+(all\s+)?(previous|prior|above)\s+(instructions?|prompts?)/i,
  /(reveal|show|print|output|repeat)\s+(your\s+)?(system\s+prompt|instructions|rules)/i,
  /you\s+are\s+now\s+(a|an|the)\s+/i,
  /<\/?system>/i,
  /\[INST\]|\[\/INST\]/i,
  /###\s*(system|instruction|human|assistant)/i,
];

function detectInjection(text) {
  for (const pattern of INJECTION_PATTERNS) {
    if (pattern.test(text)) {
      return { detected: true, pattern: pattern.source };
    }
  }

…
Частые вопросы

Что такое «prompt injection»?

Это когда кто-то пытается подсунуть ИИ скрытые команды, заставляя его игнорировать исходные инструкции и вести себя нежелательным образом.

Что такое «утечка данных» (data leakage)?

Это когда ИИ по ошибке раскрывает личную или конфиденциальную информацию, которой не должен делиться.

Как инструмент защищает от этого?

Он использует правила и проверки, чтобы распознавать попытки атаки и блокировать их до того, как они дойдут до ИИ, а также фильтрует ответы ИИ.

Подробности

Оригинальное описание автора

Secure LLM-powered applications with input validation, output controls, tenant isolation, and abuse prevention.

repo: sickn33/agentic-awesome-skills

Популярность

Звёзды на GitHub
48k
Место в рейтинге
#5077
Лицензия
MIT
Обновлён
15.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы