
Purple Llama
https://github.com/meta-llama/purplellama- Category
- Cybersecurity
- Rank
- No. 508Tools index
Previous survey · No. 502 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- meta-llama
- GitHub
- 4.4k stars
- Date
About
Meta's set of trust-and-safety tools for assessing and improving LLM security — code-scanning, jailbreak benchmarks, and input/output classifiers.
What it does
Purple Llama combines model evaluation with runtime defenses. Teams can probe models against cybersecurity scenarios, moderate conversations and images, identify hostile prompts, and inspect generated code before execution. Its approach joins offensive testing with defensive filtering, so findings can inform both model assessment and application controls.
Why it's ranked here
The project covers an unusually broad security workflow, from standards-based evaluation to concrete runtime decisions. Code inspection returns issues, severity, and block-or-warn guidance rather than a bare verdict. The package is less cohesive than that scope suggests: onboarding points to separate repositories, and licensing differs between benchmarks, models, and safeguards.
What's good
The code inspector supports eight common languages and combines regular-expression rules with Semgrep analysis. It can scan every supported language concurrently when callers do not specify one. Findings carry CWE identifiers, severity, location, rule details, and suggested treatment. The benchmark suite spans prompt injection, code-interpreter abuse, spear phishing, vulnerability exploitation, and autonomous offensive operations.
Tradeoffs
Code inspection catches every analysis exception, logs it, and returns the same non-insecure, ignore result used when nothing is found. Callers therefore need separate failure monitoring to avoid treating scanner outages as clean code. Semgrep must be available through its package or the system path, and setup creates a nearby symbolic link. Model safeguards also use Llama Community licenses rather than MIT.
How to use it well
Use it when an LLM team needs repeatable adversarial evaluation before release and runtime gates around prompts, responses, or generated code. Record benchmark results, then connect warning and blocking decisions to application policy and operational monitoring. It does not supply a complete deployment layer: the project directs adopters to separate Llama reference-system and recipe repositories for integration guidance.
Technical notes+
CodeShield/codeshield.py exposes the async CodeShield.scan_code library interface, runs supported-language analyses through asyncio.gather, and maps any Severity.ERROR finding to Treatment.BLOCK; its broad exception handler returns the initialized clean-looking result. CodeShield/insecure_code_detector/oss.py locates semgrep-core, creates an osemgrep symlink, disables metrics, emits JSON, and caps workers at 16. CodeShield/insecure_code_detector/languages.py declares the language and extension maps but limits active scanning to C, C++, C#, Java, JavaScript, PHP, Python, and Rust. SensitiveDocClassification/setup.py packages classifyit for Python 3.8 or newer and installs the classifyit console command, while SensitiveDocClassification/scanner.py loads YAML configuration and scans Google Drive through Llama Stack.
Observed
- Licensing
- Cybersecurity evaluations and Code Shield use MIT; model safeguards use the corresponding Llama Community licenses.
- Interfaces
- Code Shield provides an asynchronous Python library interface; ClassifyIt provides a console command.
- Packaging
- ClassifyIt uses setuptools, requires Python 3.8 or newer, and declares Llama Stack, YAML, Tika, Peewee, and Google API dependencies.
- Code analysis
- Code Shield uses regular-expression and Semgrep analyzers and reports CWE-linked issues with severity and optional source locations.
- Supported scan languages
- Active Code Shield scanning covers C, C++, C#, Java, JavaScript, PHP, Python, and Rust.
- Benchmark structure
- The documentation sidebar lists ten cybersecurity benchmark areas, including prompt injection, spear phishing, autopatching, and threat-intelligence reasoning.
Read from README.md, CodeShield/example.py, CodeShield/__init__.py, CodeShield/codeshield.py, CybersecurityBenchmarks/__init__.py, SensitiveDocClassification/setup.py, SensitiveDocClassification/scanner.py, CodeShield/insecure_code_detector/oss.py, SensitiveDocClassification/cli/__init__.py, CodeShield/insecure_code_detector/issues.py, CybersecurityBenchmarks/website/sidebars.js, CybersecurityBenchmarks/datasets/__init__.py, CodeShield/insecure_code_detector/usecases.py, CodeShield/insecure_code_detector/analyzers.py, CodeShield/insecure_code_detector/languages.py.
What it can do
Scan code for security vulnerabilities
Source code files → Security vulnerability report
Benchmark LLM resistance to jailbreak attempts
Large language model and jailbreak prompts → Jailbreak vulnerability assessment
Classify input prompts for safety risks
Text prompts → Safety risk classification scores
Classify LLM output responses for harmful content
LLM generated text responses → Harmful content detection results
Assess overall LLM security posture
Large language model system → Comprehensive security assessment report
Evaluate trust and safety measures
LLM deployment configuration → Trust and safety compliance metrics
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.