Repository navigation
Releases: seotarek/LightGuard-Agent
Release list
v0.7.1 - Post-v0.7.0 Enterprise Security Hardening
Highlights of v0.7.1
- Pure Python Schema Validation: Added deterministic stdlib JSON schema validation before RBAC evaluation.
- Authorization Modes: Enforced strict/production_secure/compatibility/permissive policy modes.
- Streaming Secret Guard: Added rolling buffer for cross-chunk secret detection and redacted sensitive tokens in exceptions.
- Context Propagation: Thread-safe ContextVar authorization propagation across async tasks and MCP gateways.
- SSRF Hardening: Pure-Python IP normalization (hex, decimal int, IPv6 mapped) and pre-resolution DNS rebinding defense.
- SVG Multi-Modal Security: Hardened XML ElementTree parser neutralizing entity expansion, script handlers, and dangerous schemes.
- Resource Roots: Strict path containment enforcing resource_roots boundary limits on file tools.
- Atomic Threat Intel: ReDoS-safe regex length constraints and all-or-nothing rollback for threat signature feeds.
- Zero External Runtime Dependencies: 100% standard library compliance with sub-millisecond inspection latency.
v0.7.0 - Enterprise AI Security Platform
🛡️ LightGuard-Agent v0.7.0: Production-Grade Enterprise AI Security Platform
This landmark release transforms LightGuard-Agent into an enterprise-grade AI security architecture designed for autonomous tool-calling agents, Model Context Protocol (MCP) gateways, and high-throughput RAG pipelines.
🚀 Key Capabilities & Security Enhancements
-
Centralized Tool Authorization & RBAC Engine (
lightguard.policy):- Added
ToolCapabilityenum,ToolMetadata, andToolPolicyRegistry. - Role-Based Access Control (
RBAC) viaAuthorizationContext(caller_role, caller_id). - Human-in-the-loop approval hooks (
approval_hook) for critical actions. - Enforced strict deny-over-allow precedence with default-deny semantics.
- Added
-
Deep Recursive Argument Security & SSRF Defense (
lightguard.structured):- Recursive inspection of nested dictionaries and arrays with cycle detection (
path_ids). - Bounded complexity defense with
max_depth=10andmax_elements=1000. - Complete SSRF defense blocking loopback (
127.0.0.1), private networks (RFC 1918), and cloud metadata IP (169.254.169.254). - Universal path traversal checks across all string arguments and dangerous command injection prevention.
- Recursive inspection of nested dictionaries and arrays with cycle detection (
-
Multi-Provider Streamed Tool Argument Unmarshaling (
lightguard.wrapper):- Integrated
_unmarshal_tool_argsacross synchronous and asynchronous streaming wrappers. - Transparently parses chunked and delta JSON strings into top-level dictionaries before security validation.
- Verified across OpenAI, Anthropic, Groq, and Ollama multi-tool parallel calls.
- Integrated
-
Hardened RAG Context & Metadata Poisoning Defense (
lightguard.rag):- Added
SourceTrustLevelhierarchy for untrusted vs. trusted retrieval boundaries. - Metadata prompt-injection scanning and Markdown exfiltration beacon detection (
). - Document length bounds and cryptographic canary provenance tags.
- Added
-
Hardened MCP Gateway & Tools Discovery Filtering (
lightguard.mcp_gateway):- Enforced maximum JSON-RPC payload bounds (
max_message_size), rejecting oversized frames with error code-32600. - Dynamic
tools/listdiscovery filtering hiding unauthorized tools based on caller capabilities. - Server-to-client response inspection blocking secret canary leaks.
- Enforced maximum JSON-RPC payload bounds (
-
Structured DLP Redaction & Extended Cloud Secrets (
lightguard.privacy):- Added
redact_structured()andrestore_structured()with non-colliding sequential placeholder tokens across nested JSON. - Extended secret regex patterns for Google Cloud (
AIza...), HuggingFace tokens (hf_...), Stripe keys, Anthropic, and OpenAI. - Automatic TTL pruning and capacity eviction in
CanaryGuard.
- Added
-
Structured Audit Trail & Security Reason Codes (
lightguard.audit):- Introduced
SecurityReasonCodeenum providing deterministic, programmatic reason codes for SIEM integration. - Structured
AuditEventrecords and thread-safeAuditLoggerwith in-memory ring buffer and JSONL file export. - Integrated end-to-end into observation processing, action verification, and MCP gateways.
- Introduced
📊 Verification & Test Suite
- Test Results: 162/162 passing tests (
100% pass rate) across Python 3.9, 3.10, 3.11, 3.12. - Coverage: 82% overall statement coverage (>92% across core security modules).
- Dependencies: 0 external runtime dependencies (Pure Python standard library).
v0.6.1 - Production Hardening & Independent Security Audit Resolutions
🛡️ LightGuard-Agent v0.6.1: Enterprise Hardening Release
This maintenance release directly resolves all findings from the Independent Developer Security Audit (October 21, 2026), elevating LightGuard-Agent from beta status to a hardened production-grade AI security architecture.
🔧 Key Fixes & Enhancements
- Hybrid RedactionResult:
PrivacyGuard.redact()now returns aRedactionResultcontainer supporting tuple unpacking (redacted, mapping, ms = guard.redact()), dict key access (res['entities_found'],res['redacted_text']), and attribute access. - Flexible RAG Chunk Ingestion:
RAGContextShield.build_fenced_context()now accepts raw strings, dictionary chunks ({'id': ..., 'text': ...}), and LangChain/LlamaIndex Document objects seamlessly. - Security Policy Factory & Set Proxy: Added
SecurityPolicyConfig.from_profile()and set proxy onpolicy.custom_high_stakes.add()matching published documentation. - Decoupled Normalization & Multilingual Safety: Linguistic normalization (Unicode homoglyphs, accents, zero-width chars) no longer causes false positives on benign non-English texts (e.g. French, Arabic, German).
- Explicit Tool Authorization: Added
denied_tools(unconditional blocklist) andallowed_tools(enforcing Principle of Least Privilege / Default-Deny). - Hardened MCP Security Gateway: Protected
MCPSecurityGatewayagainst non-dict JSON frames and expanded inspection coverage acrosstools/call,resources/read, andprompts/get. - Canary Token Bounded LRU/TTL: Added automatic TTL expiration and capacity eviction to
CanaryGuardpreventing memory bloat in long-running processes. - Standardized Empirical Benchmark: Upgraded
lightguard benchmarkwith an empirical multi-vector test suite measuring latency distributions, mitigation rate (100%), and false positive rate (0.0%). - Automated CI Coverage: Added
pytest-covto automated GitHub Actions matrix, verifying 101/101 tests passing across Python 3.9 through 3.12 with 81% statement coverage.
v0.6.0: Aho-Corasick O(N+M) Matcher, GCG Suffix Detector, Offline Threat Intel, Async Core & Control Center
🚀 What's New in LightGuard-Agent v0.6.0
- ⚡ Zero-Dependency Aho-Corasick Fast Matcher (
FastPatternMatcher): Linear-time (N+M)$ multi-pattern matching across thousands of adversarial injection keywords without regex backtracking overhead. - 🛡️ Adversarial Suffix & GCG Anomaly Detector (
AdversarialSuffixDetector): Statistical bigram transition entropy and punctuation burst clustering detecting automated Greedy Coordinate Gradient jailbreaks in under 0.05 ms. - 🔒 Offline Threat Intelligence Registry (
ThreatIntelRegistry): Cryptographically verified JSON threat feeds with SHA-256 checksums to sync enterprise signatures offline without updating the core package. - ⚡ High-Throughput AsyncIO Core (
AsyncLightGuardAgent): Native non-blocking coroutines (process_observation,verify_action) for FastAPI, Starlette, and asynchronous tool loops. - 🖥️ Built-in Offline Web Control Center (
lightguard dashboard): Zero-dependency local browser dashboard (powered by Pythonhttp.server) with interactive scanner, live audit generator, and Prometheus metrics onhttp://127.0.0.1:8443. - 🧪 100% Test Coverage: Expanded unit test suite with 92/92 passing tests in ~1.0s.
PyPI: https://pypi.org/project/lightguard-agent/0.6.0/
Docs: https://seotarek.github.io/LightGuard-Agent/
LightGuard-Agent v0.5.0: Swarm Shield, Standalone MCP Gateway & CISO Compliance
LightGuard-Agent v0.5.0: The Autonomous AI Security Standard 🚀
What's New in v0.5.0:
- 🐝 Multi-Agent Swarm Lateral Injection Shield (
lightguard.integrations.swarm):MultiAgentSwarmShieldandAgentTaintTrackerprevent lateral prompt injection and agent-to-agent privilege escalation across CrewAI, AutoGen, and LangGraph swarms.
- 🔌 Standalone MCP Security Gateway (
lightguard-mcp):- Intercepts and shields any upstream MCP server in Claude Desktop or Cursor IDE over stdio JSON-RPC 2.0 with sub-millisecond overhead.
- 🔗 LangGraph First-Class Guard Node:
create_langgraph_guard()hooks into LangGraph workflows to inspect and sanitize state messages between tools and the agent.
- 🖼️ Multimodal & Vision Metadata Shield (
lightguard.multimodal):- Neutralizes prompt injections embedded in SVG vector graphics, image EXIF/IPTC metadata tags, and document streams.
- 🛡️ Structured Output & Function Calling Guard (
lightguard.structured):- Prevents JSON parameter smuggling, command chaining, and path traversal in function calling arguments.
- 📋 Executive CISO & OWASP Compliance Reporting (
lightguard.reporting):lightguard report --format htmlgenerates executive audit reports mapped to OWASP Top 10 for LLMs and MITRE ATLAS.
- 🧪 Comprehensive Testing:
- 76/76 unit tests passing (0.33s), clean Ruff linting, zero external dependencies.
- Published live to PyPI:
pip install lightguard-agent==0.5.0
LightGuard-Agent v0.4.1: Professional Documentation & Enterprise Shields
LightGuard-Agent v0.4.1 🛡️
What's New:
- Upgraded, comprehensive enterprise documentation and architecture diagrams across GitHub, PyPI, and Hugging Face.
- Head-to-head comparison matrix against Llama-Guard 3, NeMo Guardrails, and Guardrails AI.
- RAG Context Poisoning Shield (
lightguard.rag) - Zero-Dependency DLP & PII Redactor with Luhn algorithm (
lightguard.privacy) - Security Policy Profiles (
lightguard.policy) - Prometheus Metrics & Telemetry Exporter (
lightguard.telemetry) - 60/60 unit tests passing in 0.50s with zero external dependencies.
LightGuard-Agent v0.4.0: Enterprise RAG Shield, DLP PII Redaction & Prometheus Telemetry
What's New in v0.4.0 🚀
1. 📚 RAG Context Poisoning Shield (lightguard.rag)
- Chunk Sanitization: Inspects retrieved text chunks for indirect prompt injection directives.
- XML Context Fencing: Encapsulates retrieved knowledge in tamper-evident boundaries.
- Poisoned Chunk Dropping: Automatically drops poisoned documents before LLM context construction.
- Retriever Proxy: Drop-in wrapping for LangChain and LlamaIndex retrievers (
shield.protect_retriever(retriever)).
2. 🔒 Zero-Dependency DLP & PII Redaction (lightguard.privacy)
- Financial Validation: Luhn checksum validation for Visa, MasterCard, Amex, Discover.
- Secrets Scanning: Auto-redacts OpenAI keys (
sk-...), Anthropic keys, AWS Access Keys, GitHub tokens. - Contact & PII: Redacts emails, phone numbers, SSNs, and IPv4 addresses.
- Reversible Anonymization: Restore original sensitive entities before executing secure local database operations.
3. ⚙️ Enterprise Security Policy Profiles (lightguard.policy)
- Out-of-the-box security postures:
STRICT,BALANCED, andPERMISSIVE. - Granular per-tool permissions and custom high-stakes registries.
4. 📈 Prometheus Telemetry & Observability (lightguard.telemetry)
- Real-time thread-safe telemetry collector.
- Exposes standard Prometheus text metrics (
export_prometheus()) with rolling latency percentiles (P95, mean).
5. 💻 CLI Subcommand Expansion
lightguard redact <text>lightguard rag-scan <chunk>lightguard metrics
📊 Verification & Tests
- 60/60 unit tests passing (0.50s)
- 100% defense rate against 26 red-team attack vectors
- Zero external runtime dependencies
- Published to PyPI:
pip install lightguard-agent==0.4.0
LightGuard-Agent v0.3.0: Enterprise Multi-Tier Defense & Universal SDK
What's New in v0.3.0:
- Tier 0 Obfuscation Shield: Full protection against Cyrillic/Greek homoglyphs, zero-width steganography, Base64/Hex decoders, and Shannon entropy anomaly detection.
- Cryptographic Canary Guard: Nonce-fenced boundaries against Indirect Prompt Injection (IPI) and system prompt exfiltration.
- Stateful Multi-Turn Session Guard: Defeats Crescendo multi-turn jailbreaks and adversarial velocity escalation.
- Universal 1-Line SDK Wrapper:
client = lightguard.wrap(OpenAI())for instant protection of OpenAI, Anthropic, Groq, and Ollama. - Production Middleware: One-line ASGI & WSGI middleware for FastAPI and Flask.
- Adversarial Red-Team CLI Engine:
lightguard auditandlightguard redteamwith 26-vector penetration simulation and ANSI dashboards. - Official PyPI Release: Available worldwide via
pip install lightguard-agent.