Skip to content

Security: galezra/ragbox

Security

SECURITY.md

Security Policy

πŸ”’ Security Overview

RAG Box is designed with security and privacy as core principles. This document outlines our security practices, how to report vulnerabilities, and our supported versions.

πŸ›‘οΈ Security Features

Data Privacy

  • 100% Offline Operation - No data leaves your infrastructure
  • Local Processing - All document processing, embedding, and LLM inference happens locally
  • No External APIs - Zero dependency on cloud services for core functionality
  • Configurable Logging - Control what information gets logged

Secure Architecture

  • Clean Architecture - Clear separation of concerns with security boundaries
  • Input Validation - All user inputs are validated and sanitized
  • Error Handling - Secure error messages that don't leak sensitive information
  • Resource Management - Proper cleanup of temporary files and memory

πŸ“‹ Supported Versions

We actively maintain security updates for the following versions:

Version Supported
0.1.x βœ… Supported
< 0.1.0 ❌ Not Supported

🚨 Reporting Security Vulnerabilities

We take security vulnerabilities seriously. If you discover a security issue, please follow responsible disclosure:

⚑ Critical Vulnerabilities

For critical security issues that could lead to:

  • Remote code execution
  • Data exfiltration
  • Privilege escalation
  • Service disruption

Contact us immediately:

  • Email: security@galezra.com (will respond within 24 hours)
  • Subject: [SECURITY] RAG Box Critical Vulnerability

πŸ” Non-Critical Issues

For lower-severity issues like:

  • Information disclosure
  • Minor input validation issues
  • Configuration security improvements

Use GitHub Security Advisories:

  1. Go to the Security tab
  2. Click "Report a vulnerability"
  3. Fill out the form with details

πŸ“ What to Include

When reporting a vulnerability, please provide:

  1. Description - Clear explanation of the vulnerability
  2. Impact - What could an attacker achieve?
  3. Reproduction Steps - How to reproduce the issue
  4. Environment - OS, Python version, RAG Box version
  5. Proof of Concept - Code or screenshots (if safe to share)
  6. Suggested Fix - If you have ideas for mitigation

βœ‰οΈ Response Process

Our security response process:

  1. Acknowledgment - Within 24-48 hours
  2. Investigation - We'll investigate and assess the impact
  3. Updates - Regular updates on progress (at least weekly)
  4. Fix Development - We'll develop and test a fix
  5. Disclosure - Coordinated disclosure after fix is available
  6. Recognition - Credit in security advisory (if desired)

πŸ” Security Best Practices

For Users

Installation Security

# Verify Poetry installation
poetry --version

# Use virtual environments
poetry install --no-dev  # For production

Configuration Security

# config/production.yaml
log_level: "WARNING" # Reduce verbose logging in production
debug_mode: false # Disable debug mode
data_dir: "/secure/path/data" # Use secure directory

File System Security

  • Restrict data directory permissions to application user only
  • Use dedicated user account for running RAG Box
  • Monitor file access logs for unusual activity
  • Regular backups of vector store and configuration

Network Security

  • Firewall rules to restrict access to Streamlit port (8501)
  • VPN access for remote users
  • HTTPS termination if exposing web interface
  • Rate limiting on API endpoints

For Developers

Code Security

# Input validation
from pathlib import Path

def safe_file_path(user_path: str) -> Path:
    """Safely resolve user-provided file paths."""
    path = Path(user_path).resolve()

    # Prevent directory traversal
    if not str(path).startswith(str(DATA_DIR.resolve())):
        raise ValueError("Path outside allowed directory")

    return path

Dependency Security

# Check for known vulnerabilities
poetry audit

# Update dependencies regularly
poetry update

# Review new dependencies carefully
poetry show --tree

Testing Security

# Test input validation
def test_path_traversal_protection():
    """Test that path traversal attacks are prevented."""
    with pytest.raises(ValueError):
        safe_file_path("../../../etc/passwd")

πŸ›‘οΈ Security Scanning

We use automated security scanning:

Static Analysis

  • Bandit - Python security linter
  • Safety - Known vulnerability scanning
  • Semgrep - Additional security patterns

Dependency Scanning

  • Poetry audit - Check for known CVEs
  • GitHub Dependabot - Automated dependency updates
  • License compliance - Ensure compatible licenses

Container Security

# Use minimal base images
FROM python:3.12-slim

# Run as non-root user
RUN useradd --create-home --shell /bin/bash ragbox
USER ragbox

# Security headers in web interface
ENV STREAMLIT_SERVER_ENABLE_CORS=false
ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=true

🚫 Known Security Considerations

Local LLM Risks

  • Model Provenance - Verify LLM model sources (Ollama, HuggingFace)
  • Model Poisoning - Use trusted model repositories
  • Resource Exhaustion - Monitor CPU/memory usage

File Processing

  • Malicious Documents - Sandboxed document processing
  • File Size Limits - Prevent DoS via large files
  • Format Validation - Strict file format checking

Vector Store

  • Index Integrity - Regular integrity checks
  • Access Control - Restrict vector store file permissions
  • Backup Security - Encrypted backups of sensitive indexes

πŸ“Š Security Monitoring

Logging

# Security-relevant events are logged
logger.warning("Failed authentication attempt", extra={
    "user_id": user_id,
    "ip_address": request.remote_addr,
    "timestamp": datetime.utcnow()
})

Metrics

  • Failed authentication attempts
  • Unusual file access patterns
  • Resource usage spikes
  • Error rate monitoring

πŸ”„ Security Updates

Update Policy

  • Critical vulnerabilities: Patched within 24-48 hours
  • High severity: Patched within 1 week
  • Medium/Low severity: Included in next regular release

Notification Channels

  • GitHub Security Advisories - For all vulnerabilities
  • Release Notes - Security fixes highlighted
  • Email notifications - For subscribed users (coming soon)

πŸ“š Additional Resources

Security Guides

Security Tools

❓ Questions?

For security-related questions that are not vulnerabilities:

  • GitHub Discussions - Public security questions
  • Email: security@galezra.com - Private security inquiries

Security is everyone's responsibility. Thank you for helping keep RAG Box secure! πŸ”’

There aren't any published security advisories