Skip to content

Commit 8a3939e

Browse files
feat: v0.4.0 "Enterprise" - Production-ready security platform
## V0.4.0 "Enterprise" Features - UnknownArgsMode: BLOCK/STRIP_AND_LOG/STRIP_SILENT replaces strict_mode - SafePath/SafeURL: Built-in safe types with automatic validation - Capability Gating: @requires decorator with fine-grained permissions - Pluggable Sandbox Backends: E2B, Docker, or Local - Circuit Breaker: Fault tolerance with CLOSED/OPEN/HALF_OPEN states - Cost Tracking: Token usage monitoring with budget limits - Retry Policies: Exponential backoff with jitter - OpenTelemetry: Distributed tracing and metrics - MCP Proxy Guard: Token passthrough prevention - CLI Tools: airlock doctor, airlock verify ## V0.3.0 "Vaccine" Features (included) - Filesystem path validation (CVE-resistant) - Network egress control (socket monkeypatch) - Honeypot deception protocol - Framework vaccination (LangChain, OpenAI SDK auto-wrap) ## Code Quality Fixes - Replace assert statements with RuntimeError checks - Add deprecation timeline (v1.0.0) to strict_mode warning - Async-aware sleep in honeypot (create_honeypot_response_async) - Refactor _pre_execution into 4 smaller methods - Thread safety documentation for all lock-using modules - Fix duplicate imports in __init__.py ## Stats - 1,136 tests passing (79.73% coverage) - ~11,400 lines of production code - 64 files changed, 17,192 insertions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4b5fe16 commit 8a3939e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+17192
-2103
lines changed

.claude/plans/v0.4.0-enterprise-plan.md

Lines changed: 766 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
# Changelog
2+
3+
All notable changes to Agent-Airlock are documented here.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
---
9+
10+
## [0.4.0] - 2026-02-01 — "Enterprise"
11+
12+
### ✨ New Features
13+
14+
- **Unknown Arguments Mode**: New `UnknownArgsMode` replaces boolean `strict_mode` with three explicit behaviors:
15+
- `BLOCK` - Reject calls with hallucinated arguments (production recommended)
16+
- `STRIP_AND_LOG` - Strip unknown args and log warnings (staging)
17+
- `STRIP_SILENT` - Silently strip unknown args (development)
18+
19+
- **Safe Types**: Built-in path and URL validation types that work with Pydantic:
20+
- `SafePath` - Validates file paths against traversal attacks
21+
- `SafePathStrict` - Stricter path validation with deny patterns
22+
- `SafeURL` - Validates URLs with protocol enforcement
23+
- `SafeURLAllowHttp` - Allows both HTTP and HTTPS
24+
25+
- **Capability Gating**: Fine-grained permission system for tool operations:
26+
- `@requires(Capability.FILESYSTEM_READ)` decorator
27+
- Predefined policies: `STRICT_CAPABILITY_POLICY`, `READ_ONLY_CAPABILITY_POLICY`
28+
- Flag-based capabilities: combine with `|` operator
29+
30+
- **Pluggable Sandbox Backends**: Choose your execution environment:
31+
- `E2BBackend` - E2B Firecracker MicroVMs (recommended)
32+
- `DockerBackend` - Docker containers (local development)
33+
- `LocalBackend` - Unsafe local execution (testing only)
34+
35+
- **Circuit Breaker**: Prevent cascading failures with fault tolerance:
36+
- `CircuitBreaker` with CLOSED/OPEN/HALF_OPEN states
37+
- Configurable failure thresholds and recovery timeouts
38+
- Predefined configs: `AGGRESSIVE_BREAKER`, `CONSERVATIVE_BREAKER`
39+
40+
- **Cost Tracking**: Monitor and limit API spending:
41+
- `CostTracker` with per-tool and aggregate tracking
42+
- `BudgetConfig` with hard/soft limits and alerts
43+
- `CostCallback` protocol for external system integration
44+
- `BudgetExceededError` when limits are reached
45+
46+
- **Retry Policies**: Intelligent retry with exponential backoff:
47+
- `RetryPolicy` with configurable attempts and delays
48+
- Jitter support to prevent thundering herd
49+
- Predefined policies: `FAST_RETRY`, `STANDARD_RETRY`, `PATIENT_RETRY`
50+
- Exception filtering with `NETWORK_EXCEPTIONS`
51+
52+
- **OpenTelemetry Observability**: Enterprise-grade monitoring:
53+
- `OpenTelemetryProvider` for distributed tracing
54+
- `observe()` context manager and decorator
55+
- Span attributes, events, and metrics
56+
- `OTelAuditExporter` for audit log integration
57+
58+
- **MCP Proxy Guard**: Enhanced MCP security:
59+
- `MCPProxyGuard` prevents token passthrough attacks
60+
- `MCPSession` binding for request authentication
61+
- Configurable with `STRICT_PROXY_CONFIG`, `PERMISSIVE_PROXY_CONFIG`
62+
63+
- **CLI Tools**: New command-line utilities:
64+
- `airlock doctor` - Diagnose configuration issues
65+
- `airlock verify` - Validate security setup
66+
67+
### 🔧 Improvements
68+
69+
- Enhanced audit logging with OpenTelemetry export support
70+
- Better error messages for capability denials
71+
- Improved thread safety in rate limiters and circuit breakers
72+
73+
---
74+
75+
## [0.3.0] - 2026-02-01 — "Vaccine"
76+
77+
### ✨ New Features
78+
79+
- **Filesystem Path Validation**: Bulletproof protection against directory traversal:
80+
- `FilesystemPolicy` with allowed roots and deny patterns
81+
- Uses `os.path.commonpath()` (CVE-resistant, not string prefix matching)
82+
- Symlink blocking to prevent escape attacks
83+
- Predefined: `RESTRICTIVE_FILESYSTEM_POLICY`, `SANDBOX_FILESYSTEM_POLICY`
84+
85+
- **Network Egress Control**: Block data exfiltration during tool execution:
86+
- `NetworkPolicy` with host/port allowlists
87+
- `network_airgap()` context manager blocks all outbound connections
88+
- Socket monkeypatching with thread-local storage for safety
89+
- Predefined: `NO_NETWORK_POLICY`, `INTERNAL_ONLY_POLICY`, `HTTPS_ONLY_POLICY`
90+
91+
- **Honeypot Deception Protocol**: Return fake success instead of errors:
92+
- `BlockStrategy.HONEYPOT` returns plausible fake data
93+
- Prevents agents from knowing access was blocked
94+
- `DefaultHoneypotGenerator` with sensible fake values
95+
- Example: Agent reads `.env` → gets `API_KEY=mickey_mouse_123`
96+
97+
- **Framework Vaccination**: One-line security for existing code:
98+
- `vaccinate("langchain")` automatically secures all `@tool` functions
99+
- Monkeypatches framework decorators to inject Airlock
100+
- Supports: LangChain, OpenAI Agents SDK, PydanticAI, CrewAI
101+
- `unvaccinate()` to restore original behavior
102+
103+
### 🔧 Improvements
104+
105+
- Path-like parameter detection with intelligent heuristics
106+
- Callback hooks: `on_blocked`, `on_rate_limit`, `on_validation_error`
107+
108+
---
109+
110+
## [0.2.0] - 2026-02-01
111+
112+
### ✨ New Features
113+
114+
- **Security Hardening**: Comprehensive security review and fixes
115+
- **Production Roadmap**: Clear path to enterprise readiness
116+
117+
### 🐛 Fixes
118+
119+
- Skip cloudpickle tests when package not installed
120+
- Resolve all ruff lint and format errors for CI
121+
122+
---
123+
124+
## [0.1.5] - 2026-01-31
125+
126+
### ✨ New Features
127+
128+
- **Streaming Support**: `StreamingAirlock` for generator functions:
129+
- Per-chunk PII/secret sanitization
130+
- Cumulative output truncation across chunks
131+
- Sync and async generator support
132+
133+
- **Context Propagation**: `AirlockContext` with `contextvars`:
134+
- `get_current_context()` available inside tools
135+
- `ContextExtractor` for RunContextWrapper pattern
136+
- Request-scoped state management
137+
138+
- **Dynamic Policy Resolution**: Policies can now be functions:
139+
- `Callable[[AirlockContext], SecurityPolicy]` support
140+
- Enables workspace/tenant-specific policies
141+
- Context extracted from first arg with `.context` attribute
142+
143+
- **Conversation Tracking**: Multi-turn state management:
144+
- `ConversationTracker` tracks tool calls across turns
145+
- `ConversationConstraints` with budget management
146+
- Cross-call tracking for agent loops
147+
148+
### 🔧 Improvements
149+
150+
- 99% test coverage (enforced 80% in CI)
151+
- 647 tests covering all features
152+
153+
---
154+
155+
## [0.1.3] - 2026-01-31
156+
157+
### ✨ New Features
158+
159+
- **Framework Compatibility**: Full support for major AI frameworks:
160+
- LangChain with `@tool` decorator
161+
- LangGraph with `ToolNode` and `StateGraph`
162+
- OpenAI Agents SDK with `@function_tool`
163+
- PydanticAI, CrewAI, AutoGen, LlamaIndex, smolagents
164+
165+
- **Signature Preservation**: Critical fix for framework introspection:
166+
- Copies `__signature__` and `__annotations__` to wrapper
167+
- Preserves Pydantic V2 attributes (`__pydantic_*`)
168+
- Enables LLMs to see correct function parameters
169+
170+
### 🔧 Improvements
171+
172+
- README upgraded to top 1% standards
173+
- Comprehensive framework integration examples
174+
175+
### 🔒 Security
176+
177+
- Fixed all vulnerabilities from security scan
178+
- Sensitive parameter names filtered from debug logs
179+
180+
---
181+
182+
## [0.1.2] - 2026-01-31
183+
184+
### 🔧 Improvements
185+
186+
- Switched to API token auth for PyPI publish
187+
- README rewritten as manifesto for launch
188+
189+
### 🐛 Fixes
190+
191+
- Resolved mypy unused-ignore error for tomli import
192+
193+
---
194+
195+
## [0.1.1] - 2026-01-31
196+
197+
### ✨ New Features
198+
199+
- **Policy Engine**: RBAC for AI agents:
200+
- `SecurityPolicy` with allow/deny tool lists
201+
- `RateLimit` with token bucket algorithm
202+
- `TimeWindow` for time-based restrictions
203+
- Predefined: `PERMISSIVE_POLICY`, `STRICT_POLICY`, `READ_ONLY_POLICY`, `BUSINESS_HOURS_POLICY`
204+
205+
- **Output Sanitization**: PII and secret masking:
206+
- 12 data types: email, phone, SSN, credit card, API keys, etc.
207+
- India-specific: Aadhaar, PAN, UPI ID, IFSC
208+
- 4 masking strategies: FULL, PARTIAL, TYPE_ONLY, HASH
209+
- Token/character truncation with configurable limits
210+
211+
- **FastMCP Integration**: MCP-native security:
212+
- `@secure_tool(mcp)` decorator
213+
- `MCPAirlock` for MCP-specific features
214+
- `create_secure_mcp_server()` factory function
215+
216+
- **Audit Logging**: JSON Lines format:
217+
- `AuditLogger` with thread-safe writes
218+
- Configurable log path
219+
- Full call tracing with args/results
220+
221+
### 📝 Documentation
222+
223+
- Complete Phase 6 launch preparation
224+
- Security best practices guide
225+
226+
---
227+
228+
## [0.1.0] - 2026-01-31
229+
230+
### ✨ New Features
231+
232+
- **Core Validator**: The `@Airlock` decorator:
233+
- Ghost argument detection and stripping
234+
- Pydantic V2 strict validation (no type coercion)
235+
- Self-healing error responses with `fix_hints`
236+
237+
- **E2B Sandbox Integration**: Isolated execution:
238+
- `SandboxPool` with warm pool management
239+
- Function serialization via cloudpickle
240+
- `sandbox_required=True` prevents local fallback
241+
242+
- **Configuration System**: Flexible config priority:
243+
- Environment variables (`AIRLOCK_*`)
244+
- Constructor parameters
245+
- TOML config files (`airlock.toml`)
246+
247+
### 🔧 Improvements
248+
249+
- Full async/await support
250+
- Comprehensive type hints throughout
251+
252+
---
253+
254+
## Links
255+
256+
- [Documentation](https://github.com/sattyamjjain/agent-airlock#readme)
257+
- [PyPI Package](https://pypi.org/project/agent-airlock/)
258+
- [Issue Tracker](https://github.com/sattyamjjain/agent-airlock/issues)

0 commit comments

Comments
 (0)