Spaces:
Configuration error
LLMGuardian
CLICK HERE FOR THE FULL PROJECT
Comprehensive LLM protection toolset aligned to addressing OWASP vulnerabilities
Author: DeWitt Gibson https://www.linkedin.com/in/dewitt-gibson/
Full Documentaion and Usage Instructions: DOCS
Please see the Projects and Issues tab above for completion roadmap
Project Structure
LLMGuardian follows a modular and secure architecture designed to provide comprehensive protection for LLM applications. Below is the detailed project structure with explanations for each component:
Directory Structure
LLMGuardian/
βββ .github/ # GitHub specific configurations
β βββ workflows/ # GitHub Actions workflows
β βββ CODEOWNERS # Repository ownership rules
β βββ ISSUE_TEMPLATE/ # Issue reporting templates
β βββ PULL_REQUEST_TEMPLATE.md # PR guidelines
βββ .circleci/ # config files for using CircleCI https://circleci.com/
β
βββ src/ # Source code
β βββ llmguardian/ # Main package directory
β βββ cli/ # Command-line interface
β βββ dashboard/ # Streamlit dashboard
β βββ core/ # Core functionality
β βββ scanners/ # Security scanning modules
β βββ defenders/ # Defense mechanisms
β βββ monitors/ # Monitoring components
β βββ api/ # API integration
| βββ vectors/ # Embeddings protection / supply chain vulnerabilities
| βββ data/ # Sensive data exposure / data poisoning
| βββ agency/ # Excessive agency protection
β βββ utils/ # Utility functions
β
βββ tests/ # Test suite
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β βββ security/ # Security-specific tests
β
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
βββ page/ # Files for GitHub pages
βββ requirements/ # Dependencies
βββ docker/ # Docker configurations
βββ config/ # Various config files
βββ app.py # Huggingface Space deployment
Component Details
Security Components
Scanners (
src/llmguardian/scanners/
)- Prompt injection detection
- Data leakage scanning
- Model security validation
- Output validation checks
Defenders (
src/llmguardian/defenders/
)- Input sanitization
- Output filtering
- Rate limiting
- Token validation
Monitors (
src/llmguardian/monitors/
)- Real-time usage tracking
- Threat detection
- Anomaly monitoring
Vectors (
src/llmguardian/vectors/
)- Embedding weaknesses
- Supply chain vulnerabilities
- Montior vector stores
Data (
src/llmguardian/data/
)- Sensitive information disclosure
- Protection from data poisoning
- Data sanitizing
Agency (
src/llmguardian/agency/
)- Permission management
- Scope limitation
- Safe execution
Core Components
CLI (
src/llmguardian/cli/
)- Command-line interface
- Interactive tools
- Configuration management
API (
src/llmguardian/api/
)- RESTful endpoints
- Middleware
- Integration interfaces
Core (
src/llmguardian/core/
)- Configuration management
- Logging setup
- Core functionality
Testing & Quality Assurance
- Tests (
tests/
)
- Unit tests for individual components
- Integration tests for system functionality
- Security-specific test cases
- Vulnerability testing
Documentation & Support
- Documentation (
docs/
)
- API documentation
- Implementation guides
- Security best practices
- Usage examples
- Docker (
docker/
)
- Containerization support
- Development environment
- Production deployment
Development Tools
- Scripts (
scripts/
)- Setup utilities
- Development tools
- Security checking scripts
Dashboard
- Dashboard(
src/llmguardian/dashboard/
)
- Streamlit app
- Visualization
- Monitoring and control
Key Files
pyproject.toml
: Project metadata and dependenciessetup.py
: Package setup configurationrequirements/*.txt
: Environment-specific dependencies.pre-commit-config.yaml
: Code quality hooksCONTRIBUTING.md
: Contribution guidelinesLICENSE
: MIT license terms
Design Principles
The structure follows these key principles:
- Modularity: Each component is self-contained and independently maintainable
- Security-First: Security considerations are built into the architecture
- Scalability: Easy to extend and add new security features
- Testability: Comprehensive test coverage and security validation
- Usability: Clear organization and documentation
Getting Started with Development
To start working with this structure:
- Fork the repository
- Create and activate a virtual environment
- Install dependencies from the appropriate requirements file
- Run the test suite to ensure everything is working
- Follow the contribution guidelines for making changes
Huggingface
Huggingface Space Implementation:
https://huggingface.co/spaces/Safe-Harbor/LLMGuardian
Create FastAPI backend with:
- Model scanning endpoints
- Prompt injection detection
- Input/output validation
- Rate limiting middleware
- Authentication checks
Gradio UI frontend with:
- Model security testing interface
- Vulnerability scanning dashboard
- Real-time attack detection
- Configuration settings