본문으로 건너뛰기
Skillpedia
에이전트48k · #5077

llm-app-security

하는 일

이 도구는 AI 기반 애플리케이션을 공격과 오용으로부터 보호하는 데 도움을 줍니다. 사용자 입력을 확인하고 출력을 통제해, AI가 조작되거나 정보가 새는 것을 막습니다.

사용하는 경우

  • ✓고객 서비스 챗봇을 만들 때.
  • ✓소프트웨어 제품에 AI를 통합할 때.
  • ✓민감한 정보를 처리하는 데 AI를 사용할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/llm-app-security/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 AI 애플리케이션을 공격으로부터 보호해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

사용자가 입력한 내용이 악의적이거나 AI를 속이려는 것이 아닌지 확인합니다. 또한 AI의 응답을 통제해 기밀 데이터를 드러내지 않도록 합니다.

기술 내용 (원본 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 };
    }
  }

…
자주 묻는 질문

‘프롬프트 인젝션’이란 무엇인가요?

누군가가 AI에게 비밀 명령을 내려 원래의 지시를 무시하고 바람직하지 않게 행동하도록 만드는 것입니다.

‘데이터 유출’이란 무엇인가요?

AI가 실수로 공유하면 안 되는 개인 정보나 기밀 정보를 드러내는 것입니다.

이 도구는 이런 위험에 어떻게 대응하나요?

규칙과 검사를 사용해 공격 시도를 AI에 도달하기 전에 식별하고 차단하며, AI의 응답도 걸러냅니다.

상세 정보

작성자의 원본 설명

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

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5077
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬