Skip to content

About

End-to-end Al/LLM security, safety and penetration testing framework for prompt injection, jailbreaks, RAG security, agentic attacks, red teaming, and monitoring.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ LLM Strata β€” AI/LLM Security & Safety Testing Framework

Python 3.10-3.14 Apache 2.0 License GitLab CI OWASP LLM Top 10 Modules PRs Welcome

🎯 Objective

LLMs are powerful β€” but they can be manipulated, abused, and exploited in ways traditional software cannot. LLM Strata is a Python framework for testing and monitoring LLM-powered applications across their lifecycle. It provides configurable coverage.

  • πŸ” Before deployment β€” find vulnerabilities, safety gaps, and adversarial weaknesses
  • 🚧 At runtime β€” demonstrate input/output scanning and policy controls that applications can integrate in real-time
  • πŸ“ˆ In production β€” continuously monitor for safety drift and suspicious behaviour

LLM Strata is a collection of independent security and safety test layers. The layers share provider profiles, credential loading, and report conventions, so you can switch the model under test with one setting and run every layer against it.This framework provides configurable coverage across documented LLM security and safety threat categories using 14 modules.

πŸ’‘ Why This Project is Useful

πŸ‘©β€πŸ’» For Developers

  • Assess selected OWASP LLM Top 10 threat categories before release
  • Identify jailbreak, prompt-injection, and harmful-output risks before deployment
  • Run the configured security pipeline through one orchestrator command: python run_security.py

πŸ” For Security Teams

  • Run structured automated and human red-team exercises with logged, scored results
  • Map instrumented tests to documented OWASP LLM Top 10 threat categories
  • Replace ad-hoc testing with a repeatable workflow and reviewable evidence

🧠 For AI/ML Teams

  • Evaluate configured RAG safety cases, including context poisoning and grounding risks
  • Score selected safety metrics and save structured JSON reports
  • Connect supported providers through profiles and module configuration

🏭 For Production Systems

  • Use LLM Guard as a reference for local input/output scanning and control benchmarking
  • Send instrumented requests and safety scores to LangFuse
  • Review safety trends over time to identify potential drift

βš™οΈ Capabilities

Capability Purpose Typical use
πŸ§ͺ Pre-deployment assessment Identify prompt injection, jailbreak, leakage, misuse, and safety weaknesses Pull requests, release candidates, scheduled assessments
βš”οΈ Adversarial attack simulation Exercise encoded, multilingual, in-context, agentic, backdoor, and RAG attack paths Security validation and red-team exercises
🚧 Runtime reference controls Demonstrate local input/output scanning and policy checks for application integration Control benchmarking and defense-in-depth validation
πŸ“‘ Production monitoring Capture traces and safety scores for instrumented requests Drift detection and operational review
🧾 Evidence and reporting Persist structured JSON results and CI artifacts Triage, audit evidence, and remediation tracking

πŸ—ΊοΈ Security and Safety Capability Map

LLM Strata is composed of 14 independent security and safety layers. Each layer has its own runner, configuration, outputs, and direct command, so it can be executed independently or as part of the full pipeline. The layers share provider, profile, and reporting utilities while remaining independently configurable.

The framework combines pre-deployment testing, runtime scanning, agent/RAG security tests, human review, and production monitoring. Coverage is configurable and should be interpreted as evidence from the selected test corpus.

πŸ‘† Click any module name above to open its dedicated guide and learn more about its purpose, configuration, usage, outputs, and coverage.

πŸ—οΈ Architecture

The framework is organized into three operational stages:

flowchart LR
    change["Code change or release candidate"] --> scan["SCAN<br/>Assessment and vulnerability checks"]
    scan --> attack["ATTACK<br/>Adversarial and abuse-case simulation"]
    attack --> monitor["MONITOR<br/>Instrumented production telemetry"]

    app["LLM application"] --> controls["Runtime reference controls<br/>Input/output policy checks"]
    app --> monitor
Loading

Each runner is independently configurable. Reports should be interpreted as evidence from the selected test corpus.

πŸš€ Quick start

πŸ“‹ Prerequisites

  • 🐍 Python 3.10-3.14 (Python 3.14 is supported; Python 3.10-3.12 remains the most conservative compatibility range)
  • πŸ”‘ Credentials for the selected model provider, where required
  • πŸ“‘ LangFuse credentials only when production monitoring is enabled
  • 🌐 Network access to the target model or a reachable private/local endpoint

πŸ“₯ Install

Clone the repository:

git clone https://github.com/VenkateshDoijode/LLM-Strata.git
cd LLM-Strata

Then run the setup:

python setup.py

The setup process creates the main virtual environment, installs dependencies, provisions the isolated Garak environment, and creates report directories.

πŸ”‘ Configure credentials

Create a local environment file from the provided template, then keep only the variables required by your selected profile.

Windows PowerShell:

Copy-Item .env.example .env

Linux/macOS:

cp .env.example .env

Configure the applicable provider variables in .env or in the operating-system environment:

Provider/profile Required variables
OpenAI (production, cost_optimized, redteam) OPENAI_API_KEY
Azure OpenAI (azure) AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT
Gemini (gemini) GEMINI_API_KEY
Hugging Face (huggingface) HF_TOKEN
Anthropic (anthropic) ANTHROPIC_API_KEY
AWS Bedrock (bedrock) AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME
Ollama (local) No cloud key by default; start the Ollama service
Private compatible endpoint (private_compatible) OPENAI_COMPATIBLE_BASE_URL and an optional OPENAI_COMPATIBLE_API_KEY

βœ… Select any one provider of your choice β€” you don't need to set up all of them. Configure only the variables required by the provider/profile you plan to use.

For production monitoring, also set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY. Operating-system variables take precedence over .env values. Never commit .env, API keys, provider endpoints containing credentials, or generated reports. See Providers and Secrets for the full provider matrix and precedence rules.

πŸŽ›οΈ Select a model profile

Set active_profile in profiles.yaml, or override it for one process:

$env:ACTIVE_PROFILE = "private_compatible"
python run_security.py --dry-run

Available profiles include OpenAI, Azure, Ollama, Gemini, Hugging Face, Anthropic through LiteLLM, AWS Bedrock through LiteLLM, and private OpenAI-compatible endpoints. See profiles.yaml for the current profile definitions.

βœ… Validate and run

Start with a non-networked orchestration check:

python run_security.py --dry-run

Run the configured pipeline only after reviewing credentials, data handling, and cost:

python run_security.py

Run the focused unit tests:

python -m unittest discover -s agent_security/tests -v

πŸ”Œ Supported Providers

The current provider adapters are:

  • ☁️ OpenAI
  • πŸ”· Azure OpenAI
  • πŸ¦™ Ollama
  • πŸ”΅ Google Gemini
  • πŸ€— Hugging Face Inference API
  • 🧩 Anthropic through LiteLLM
  • 🟠 AWS Bedrock through LiteLLM
  • πŸ”’ Private and on-premises OpenAI-compatible endpoints

🌍 Supported Deployment Contexts

The framework can assess these deployment contexts when the target is reachable through a supported interface:

  • ☁️ Cloud LLM
  • 🏒 Private Cloud LLM
  • πŸ’» Local/On-Prem LLM
  • πŸ“± Edge LLM
  • πŸ”€ Hybrid LLM
  • πŸ” Air-Gapped LLM
  • πŸ“¦ Containerized LLM
  • 🌐 Multi-Cloud LLM
  • 🧱 Embedded/Application LLM

πŸ’‘ The framework supports OpenAI-compatible endpoints and selected LiteLLM-backed providers. Additional LiteLLM providers can be integrated through client_factory.py and profiles.yaml. See Providers and Secrets.

πŸ”„ CI/CD

The GitLab pipeline is organized into three stages:

Stage Purpose Examples
πŸ” scan Core security and safety assessment Vulnerability scanning, safety evaluation, agentic red teaming
βš”οΈ attack Advanced adversarial simulation Encoding, multilingual, in-context, tool injection, backdoor, RAG security
πŸ“‘ monitor Instrumented monitoring LangFuse traces and safety scores

Run the CI-equivalent dry run locally:

python run_security.py --dry-run
python run_security.py --ci --skip-langfuse

The pipeline stores reports under results/ as CI artifacts. Review reports rather than relying only on job status; advisory attack jobs may complete successfully while reporting unsafe behavior.


πŸ“š Documentation

Guide Description
πŸ—οΈ Architecture Pipeline phases, trust boundaries, and data flow
🎯 Threat model Assets, actors, assumptions, and coverage boundaries
πŸ”‘ Providers and secrets Profiles, credentials, endpoints, and provider integration
πŸ”„ CI/CD operations Stages, variables, artifacts, and release guidance
🧾 Results and triage Outcome interpretation and remediation workflow
🏭 Production integration Runtime enforcement and monitoring integration

πŸ“ Project structure

LLM-Strata/
β”œβ”€β”€ run_security.py          # Main pipeline runner
β”œβ”€β”€ profiles.yaml            # Model profile selection
β”œβ”€β”€ profile_loader.py        # Profile loading
β”œβ”€β”€ env_loader.py            # Credential and .env loading
β”œβ”€β”€ client_factory.py        # OpenAI-compatible client creation
β”œβ”€β”€ ragas_config.yaml        # RAGAS configuration
β”œβ”€β”€ requirements.txt         # Python dependencies
β”œβ”€β”€ setup.py                 # Package setup
β”œβ”€β”€ gitlab-ci.yml            # GitLab CI pipeline definition
β”œβ”€β”€ garak/                   # Layer 1
β”œβ”€β”€ deepeval/                # Layer 2
β”œβ”€β”€ ragas/                   # Layer 3
β”œβ”€β”€ pyrit/                   # Layer 4
β”œβ”€β”€ llm_guard/               # Layer 5
β”œβ”€β”€ langfuse/                # Layer 6
β”œβ”€β”€ human_redteam/           # Layer 7
β”œβ”€β”€ encoded_attacks/         # Layer 8
β”œβ”€β”€ many_shot/               # Layer 9
β”œβ”€β”€ multilingual/            # Layer 10
β”œβ”€β”€ tool_inject/             # Layer 11
β”œβ”€β”€ backdoor/                # Layer 12
β”œβ”€β”€ rag_security/            # Layer 13
β”œβ”€β”€ agent_security/          # Layer 14
β”œβ”€β”€ Docs/                    # Threat model, architecture, CI/CD, triage, integration
└── results/                 # Generated reports 

🀝 Contributing

Contributions are welcome! πŸŽ‰ Fork the repository, make your change, and open a pull request with a short description of what you changed and why.


πŸ“„ License

LLM Strata is open source. See the LICENSE file for the license terms.


πŸ‘€ Author

Created and maintained by Venkateshwara Doijode.

About

End-to-end Al/LLM security, safety and penetration testing framework for prompt injection, jailbreaks, RAG security, agentic attacks, red teaming, and monitoring.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages