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

defending-llms-with-guardrails

하는 일

이 도구는 AI를 사용하는 애플리케이션에 보안 계층을 추가합니다. AI에 던지는 질문과 AI가 내놓는 답을 검사해, 위험하거나 부적절한 정보가 오가지 않도록 막습니다.

사용하는 경우

  • ✓AI 애플리케이션을 실제 환경에 배포할 때.
  • ✓AI를 속이려는 시도(탈옥)를 차단할 때.
  • ✓AI가 민감한 정보를 드러내거나 유해한 콘텐츠를 만들지 않도록 막는 경우.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/defending-llms-with-guardrails/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/defending-llms-with-guardrails/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분.

작동 방식

Llama Guard, NeMo Guardrails, LLM Guard라는 세 가지 시스템이 함께 작동합니다. 하나는 콘텐츠를 검사하고, 다른 하나는 대화를 통제하며, 세 번째는 입력과 출력에서 특정 문제를 검사합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Defending LLMs with Guardrails

Defensive scope: This skill describes runtime defenses for production LLM applications. The example jailbreak/injection payloads exist only to validate that guardrails block them. Test against systems you own or are authorized to assess.

Overview

Large language model (LLM) applications are exposed to adversarial input (jailbreaks, prompt injection, toxic content) and can emit unsafe, biased, or sensitive output. A guardrail is a runtime control that inspects and constrains the data flowing into and out of an LLM. Three production-grade, open-source guardrail systems dominate the ecosystem and are complementary rather than mutually exclusive:

  • Llama Guard 3 (Meta) — a Llama-3.1-8B model fine-tuned as a safety classifier. Given a prompt or a response, it emits safe or unsafe plus the violated MLCommons hazard categories (S1–S14). It is the strongest semantic content-safety classifier of the three and supports prompt classification, response classification, and tool-call/code-interpreter classification across 8 languages.
  • NeMo Guardrails (NVIDIA) — a programmable dialogue-rail framework. You define input, output, dialog, retrieval, and execution rails in a config.yml plus Colang (.co) flows. It can call external models (including Llama Guard) as actions, enforce topical boundaries, and add fact-checking/jailbreak-detection rails.
  • LLM Guard (Protect AI) — a scanner pipeline with 15 input scanners and 20 output scanners (PromptInjection, Toxicity, Anonymize/Deanonymize, Secrets, BanTopics, Sensitive, Regex, etc.). It returns a sanitized string, a validity flag, and a risk score per scanner, making it ideal for a deterministic pre/post pipeline.

This skill maps to MITRE ATLAS AML.T0054 — LLM Jailbreak: the guardrail layer is the mitigation that detects and blocks jailbreak/injection attempts before they reach (or after they leave) the model.

When to Use

  • When deploying an LLM/RAG/agent application to production and needing a runtime safety layer.
  • When you must block jailbreaks and prompt injection (OWASP LLM01) before they reach the model.
  • When you must moderate model output for toxicity, PII leakage, secrets, or off-topic responses.
  • When validating that a guardrail configuration actually blocks a corpus of known-bad payloads.
  • When layering defense-in-depth: a deterministic scanner (LLM Guard) plus a semantic classifier (Llama Guard) plus dialog rails (NeMo).

Prerequisites

  • Python 3.9+ (LLM Guard requires 3.9+; Llama Guard via transformers requires transformers>=4.43).
  • GPU recommended for Llama Guard 3 8B (CPU works for the 1B variant or quantized builds).
  • A Hugging Face account with accepted Meta Llama license to download meta-llama/Llama-Guard-3-8B.
# LLM Guard
python -m pip install llm-guard

# NeMo Guardrails
python -m pip install nemoguardrails

# Llama Guard via Hugging Face transformers
python -m pip install "transformers>=4.43" torch accelerate huggingface_hub
huggingface-cli login   # accept the Meta Llama license first on the model page

Objectives

  • Run Llama Guard 3 as a prompt and response safety classifier and parse its category output.
  • Build an LLM Guard input/output scanner pipeline with PromptInjection, Toxicity, Secrets, and Anonymize scanners.
  • Author a NeMo Guardrails config.yml plus Colang flows with input/output/jailbreak rails.
  • Wire Llama Guard into NeMo as a content-safety check.
  • Validate the combined stack against a corpus of jailbreak and injection payloads.

MITRE ATT&CK Mapping

ID Tactic Official Technique Name Role in this skill
AML.T0054 ATLAS: Defense Evasion / Impact LLM Jailbreak Guardrails detect and block the jailbreak attempt this technique describes
AML.T0051 ATLAS: Initial Access LLM Prompt Injection Input rails / PromptInjection scanner block direct injection
AML.T0051.001 ATLAS: Initial Access LLM Prompt Injection: Indirect Retrieval/input scanning blocks injection in retrieved content
AML.T0057 ATLAS: Exfiltration LLM Data Leakage Output scanners (Sensitive, Secrets, Deanonymize) block leakage

Workflow

Step 1: Classify prompts and responses with Llama Guard 3

…

자주 묻는 질문

'탈옥(jailbreak)'과 '프롬프트 인젝션'은 무엇인가요?

'탈옥'은 AI가 안전 규칙을 무시하게 만들려는 시도입니다. '프롬프트 인젝션'은 AI에 주는 지시문 속에 악의적인 명령을 끼워 넣는 것입니다.

이 도구는 어떤 유해한 콘텐츠를 차단하나요?

유해한 콘텐츠, 개인 식별 정보(PII), 비밀 정보, 주제에서 벗어난 답변뿐 아니라 탈옥과 프롬프트 인젝션 시도도 차단합니다.

세 가지 시스템(Llama Guard, NeMo, LLM Guard)을 모두 사용해야 하나요?

이들은 서로 보완하며 각각 다른 종류의 보호를 제공합니다. 둘 이상을 사용하면 애플리케이션의 전체 보안이 높아집니다.

상세 정보

작성자의 원본 설명

Deploys Llama Guard 3 safety classification, NeMo Guardrails programmable dialogue rails, and LLM Guard input/output scanner pipelines as complementary runtime defenses that inspect and constrain LLM prompts and responses. Use when adding a production runtime safety layer to an LLM, RAG, or agent application to block jailbreaks, prompt injection (OWASP LLM01), toxic content, or sensitive-data leak

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#7775
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬