argenis de la rosa
47c5006de4
Merge remote-tracking branch 'origin/feat/whatsapp-email-channels'
...
# Conflicts:
# Cargo.lock
# src/config/schema.rs
# src/cron/mod.rs
# src/security/secrets.rs
# src/service/mod.rs
2026-02-15 06:37:51 -05:00
Argenis
5cc02c5813
fix: add WhatsApp webhook signature verification (X-Hub-Signature-256)
...
Closes #51
- Add HMAC-SHA256 signature verification for WhatsApp webhooks
- Prevents message spoofing attacks (CWE-345)
- Add whatsapp_app_secret config field with ZEROCLAW_WHATSAPP_APP_SECRET env override
- Add 13 comprehensive unit tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:17:24 -05:00
fettpl
882e1320dc
fix: consolidate all env-var override tests to eliminate parallel races
...
Extends the temperature test fix to also cover provider, api_key, port,
and host env-var tests that had the same race condition.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:26:51 +01:00
fettpl
6f64099a48
fix: replace unstable is_multiple_of with modulo and fix flaky temp test
...
The `is_multiple_of` method is unstable before Rust 1.87, breaking Docker
builds that use rust:1.83-slim. Also merges the two temperature env-var
tests into one to eliminate the race condition when tests run in parallel.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:29:23 +01:00
argenis de la rosa
09d3140127
feat: add Docker env var support for PORT, HOST, and TEMPERATURE
...
- Add port and host fields to GatewayConfig with defaults (3000, 127.0.0.1)
- Enhanced apply_env_overrides() to support:
- ZEROCLAW_GATEWAY_PORT or PORT - Gateway server port
- ZEROCLAW_GATEWAY_HOST or HOST - Gateway bind address
- ZEROCLAW_TEMPERATURE - Default temperature (0.0-2.0)
- Add comprehensive tests for all new env var overrides
- Fix clippy warnings (is_multiple_of, too_many_lines)
Closes #45
2026-02-14 16:19:26 -05:00
argenis de la rosa
a310e178db
fix: add missing port/host fields to GatewayConfig and apply_env_overrides method
...
- Add port and host fields to GatewayConfig struct
- Add default_gateway_port() and default_gateway_host() functions
- Add apply_env_overrides() method to Config for env var support
- Fix test to include new GatewayConfig fields
All tests pass.
2026-02-14 16:05:13 -05:00
argenis de la rosa
554f6e9ea5
feat: add browser automation tool using Vercel agent-browser
...
- Add src/tools/browser.rs with BrowserTool implementation
- Wraps agent-browser CLI for AI-optimized web browsing
- Supports: open, snapshot, click, fill, type, screenshot, wait, etc.
- Uses refs (@e1, @e2) from accessibility snapshots for precise element selection
- JSON output mode for LLM integration
- Security: allowlist-only domains, blocks private/local hosts
- Add session_name to BrowserConfig for persistent sessions
- Register BrowserTool in tools/mod.rs alongside BrowserOpenTool
All tests pass.
2026-02-14 15:46:36 -05:00
argenis de la rosa
5476195a7f
refactor: remove AIEOS identity support
...
- Remove src/identity/ directory (aieos.rs, mod.rs)
- Remove IdentityConfig struct and identity field from Config
- Remove build_system_prompt_with_identity and load_aieos_from_config functions
- Remove AIEOS-related imports from channels/mod.rs
- Remove identity module declarations from main.rs and lib.rs
- Remove AIEOS tests from config/schema.rs
- Keep OpenClaw markdown-based identity as the only supported format
This simplifies the codebase by removing unused AIEOS complexity.
All 832 tests pass.
2026-02-14 14:05:14 -05:00
argenis de la rosa
acea042bdb
feat: add AIEOS identity support and harden cron scheduler security
...
- Add IdentityConfig with format=openclaw|aieos, aieos_path, and aieos_inline
- Implement AIEOS v1.1 JSON parser and system prompt injection
- Add build_system_prompt_with_identity() supporting both OpenClaw markdown and AIEOS JSON
- Harden cron scheduler with SecurityPolicy checks (command allowlist, forbidden path arguments)
- Skip retries on deterministic security policy violations
- Add comprehensive tests for AIEOS config and cron security edge cases
- Update README with AIEOS documentation and schema overview
- Add .dockerignore tests for build context security validation
2026-02-14 13:26:08 -05:00
argenis de la rosa
76074cb789
fix: run Docker container as non-root user ( closes #34 )
...
- Switch to gcr.io/distroless/cc-debian12:nonroot
- Add explicit USER 65534:65534 directive
- Add Docker security CI job verifying non-root UID, :nonroot base, and USER directive
- Document CIS Docker Benchmark compliance in SECURITY.md
- Add tests and edge cases for container security
2026-02-14 13:16:33 -05:00
argenis de la rosa
cc08f4bfff
feat: Add full WhatsApp Business Cloud API integration
...
- Add WhatsApp channel module with Cloud API v18.0 support
- Implement webhook-based message reception and API sending
- Add allowlist for phone numbers (E.164 format or wildcard)
- Add WhatsApp webhook endpoints to gateway (/whatsapp GET/POST)
- Add WhatsApp config schema with TOML support
- Wire WhatsApp into channel factory, CLI, and doctor commands
- Add WhatsApp to setup wizard with connection testing
- Add comprehensive test coverage (47 channel tests + 9 URL decoding tests)
- Update README with detailed WhatsApp setup instructions
- Support text messages only, skip media/status updates
- Normalize phone numbers with + prefix
- Handle webhook verification with Meta challenge-response
All 756 tests pass. Ready for production use.
2026-02-14 13:10:16 -05:00
argenis de la rosa
ec2d5cc93d
feat: enhance agent personality, tool guidance, and memory hygiene
...
- Expand communication style presets (professional, expressive, custom)
- Enrich SOUL.md with human-like tone and emoji-awareness guidance
- Add crash recovery and sub-task scoping guidance to AGENTS.md scaffold
- Add 'Use when / Don't use when' guidance to TOOLS.md and runtime prompts
- Implement memory hygiene system with configurable archiving and retention
- Add MemoryConfig options: hygiene_enabled, archive_after_days, purge_after_days, conversation_retention_days
- Archive old daily memory and session files to archive subdirectories
- Purge old archives and prune stale SQLite conversation rows
- Add comprehensive tests for new features
2026-02-14 11:28:39 -05:00
argenis de la rosa
3d91c40970
refactor: simplify CLI commands and update architecture docs
...
1. Simplify CLI:
- Make 'onboard' quick setup default (remove --quick)
- Add --interactive flag for full wizard
- Make 'status' detailed by default (remove --verbose)
- Remove 'tools list/test' and 'integrations list' commands
- Add 'channel doctor' command
2. Update Docs:
- Update architecture.svg with Channel allowlists, Browser allowlist, and latest stats
- Update README.md with new command usage and browser/channel config details
3. Polish:
- Browser tool integration
- Channel allowlist logic (empty = deny all)
2026-02-14 05:17:16 -05:00
argenis de la rosa
1fd51f1984
fix: resolve all clippy --all-targets warnings across 15 files
...
- gateway/mod.rs: move send_json before test module (items_after_test_module)
- memory/vector.rs: fix float_cmp, cast_precision_loss, approx_constant
- memory/chunker.rs: fix format_collect, format_push_string, write_with_newline
- memory/sqlite.rs: fix useless_vec
- heartbeat/engine.rs: fix format_collect, write_with_newline
- config/schema.rs: fix needless_raw_string_hashes
- tools/composio.rs: fix needless_raw_string_hashes
- integrations/registry.rs: fix uninlined_format_args, unused import
- tunnel/mod.rs: fix doc_markdown
- skills/mod.rs: allow similar_names in test module
- channels/cli.rs: fix unreadable_literal
- observability/mod.rs: fix manual_string_new
- runtime/mod.rs: fix manual_string_new
- examples/custom_memory.rs: add Default impl (new_without_default)
- examples/custom_channel.rs: fix needless_borrows_for_generic_args
2026-02-14 03:52:57 -05:00
argenis de la rosa
f8befafe4d
feat: add Composio tool provider + encrypted secret store + wizard integration
...
- src/tools/composio.rs: ComposioTool implementing Tool trait
- list/execute/connect actions via Composio API (1000+ OAuth apps)
- 60s timeout, proper error handling, JSON schema for LLM
- 12 tests covering schema, validation, serde, error paths
- src/security/secrets.rs: SecretStore for encrypted credential storage
- XOR cipher with random 32-byte key stored in ~/.zeroclaw/.secret_key
- enc: prefix for encrypted values, plaintext passthrough (backward compat)
- Key file created with 0600 permissions (Unix)
- 16 tests: roundtrip, unicode, long secrets, corrupt hex, permissions
- src/config/schema.rs: ComposioConfig + SecretsConfig structs
- Composio: enabled (default: false), api_key, entity_id
- Secrets: encrypt (default: true)
- Both with serde(default) for backward compatibility
- 8 new config tests
- src/onboard/wizard.rs: new Step 5 'Tool Mode & Security'
- Sovereign (local only) vs Composio (managed OAuth) selection
- Encrypted secret storage toggle (default: on)
- 7-step wizard (was 6)
- src/tools/mod.rs: all_tools() now accepts optional composio_key
- src/agent/loop_.rs: wires Composio key from config into tool registry
- README.md: Composio integration + encrypted secrets documentation
1017 tests, 0 clippy warnings, cargo fmt clean.
2026-02-14 02:41:29 -05:00
argenis de la rosa
b2aff60722
security: pass all 4 checklist items — gateway not public, pairing required, filesystem scoped, tunnel access
...
Security checklist from @anshnanda / @ledger_eth:
✅ Gateway not public — default bind 127.0.0.1, refuses 0.0.0.0 without
tunnel or explicit allow_public_bind=true in config
✅ Pairing required — one-time 6-digit code printed on startup, exchanged
for bearer token via POST /pair, enforced on all /webhook requests
✅ Filesystem scoped (no /) — workspace_only=true by default, null byte
injection blocked, 14 system dirs + 4 sensitive dotfiles in forbidden
list, is_resolved_path_allowed() for symlink escape prevention
✅ Access via Tailscale/SSH tunnel — tunnel system integrated, gateway
refuses public bind without active tunnel
New files:
src/security/pairing.rs — PairingGuard with OTP generation, constant-time
code comparison, bearer token issuance, token persistence
Changed files:
src/config/schema.rs — GatewayConfig (require_pairing, allow_public_bind,
paired_tokens), expanded AutonomyConfig forbidden_paths
src/config/mod.rs — export GatewayConfig
src/gateway/mod.rs — public bind guard, pairing enforcement on /webhook,
/pair endpoint, /health no longer leaks version/memory info
src/security/policy.rs — null byte blocking, is_resolved_path_allowed(),
expanded forbidden_paths (14 system dirs + 4 dotfiles)
src/security/mod.rs — export pairing module
src/onboard/wizard.rs — wire gateway config
935 tests passing (up from 905), 0 clippy warnings, cargo fmt clean
2026-02-14 00:39:51 -05:00
argenis de la rosa
0e7f501fd6
feat: full-stack search engine — FTS5, vector search, hybrid merge, embedding cache, chunker
...
The Full Stack (All Custom):
- Vector DB: embeddings stored as BLOB, cosine similarity in pure Rust
- Keyword Search: FTS5 virtual tables with BM25 scoring + auto-sync triggers
- Hybrid Merge: weighted fusion of vector + keyword results (configurable weights)
- Embeddings: provider abstraction (OpenAI, custom URL, noop fallback)
- Chunking: line-based markdown chunker with heading preservation
- Caching: embedding_cache table with LRU eviction
- Safe Reindex: rebuild FTS5 + re-embed missing vectors
New modules:
- src/memory/embeddings.rs — EmbeddingProvider trait + OpenAI + Noop + factory
- src/memory/vector.rs — cosine similarity, vec↔bytes, ScoredResult, hybrid_merge
- src/memory/chunker.rs — markdown-aware document splitting
Upgraded:
- src/memory/sqlite.rs — FTS5 schema, embedding column, hybrid recall, cache, reindex
- src/config/schema.rs — MemoryConfig expanded with embedding/search settings
- All callers updated to pass api_key for embedding provider
739 tests passing, 0 clippy warnings (Rust 1.93.1), cargo-deny clean
2026-02-14 00:00:23 -05:00
argenis de la rosa
390cbc0a6c
feat: agnostic tunnel system — bring your own tunnel provider
...
New Tunnel trait + 5 implementations:
- NoneTunnel: local-only, no external exposure (default)
- CloudflareTunnel: wraps cloudflared binary, extracts public URL
- TailscaleTunnel: tailscale serve (tailnet) or funnel (public)
- NgrokTunnel: wraps ngrok binary, supports custom domains
- CustomTunnel: user-provided command with {port}/{host} placeholders
Config schema:
- [tunnel] section with provider selector
- Provider-specific sub-configs: cloudflare, tailscale, ngrok, custom
- Backward compatible (serde default = "none")
Gateway integration:
- Tunnel starts automatically on 'zeroclaw gateway'
- Prints public URL on success, falls back to local on failure
20 new tests (factory, constructors, NoneTunnel async start/health)
649 tests passing, 0 clippy warnings, cargo fmt clean
2026-02-13 16:25:01 -05:00
argenis de la rosa
bc31e4389b
style: cargo fmt — fix all formatting for CI
...
Ran cargo fmt across entire codebase to pass CI's cargo fmt --check.
No logic changes, only whitespace/formatting.
2026-02-13 16:03:50 -05:00
argenis de la rosa
a5887ad2dc
docs+tests: architecture diagram, security docs, 75 new edge-case tests
...
README:
- Add ASCII architecture flow diagram showing all layers
- Add Security Architecture section (Layer 1: Channel Auth,
Layer 2: Rate Limiting, Layer 3: Tool Sandbox)
- Update test count to 629
New edge-case tests (75 new):
- SecurityPolicy: command injection (semicolon, backtick, dollar-paren,
env prefix, newline), path traversal (encoded dots, double-dot in
filename, null byte, symlink, tilde-ssh, /var/run), rate limiter
boundaries (exactly-at, zero, high), autonomy+command combos,
from_config fresh tracker
- Discord: exact match not substring, empty user ID, wildcard+specific,
case sensitivity, base64 edge cases
- Slack: exact match, empty user ID, case sensitivity, wildcard combo
- Telegram: exact match, empty string, case sensitivity, wildcard combo
- Gateway: first-match-wins, empty value, colon in value, different
headers, empty request, newline-only request
- Config schema: backward compat (Discord/Slack without allowed_users),
TOML roundtrip, webhook secret presence/absence
629 tests passing, 0 clippy warnings
2026-02-13 16:00:15 -05:00
argenis de la rosa
542bb80743
security: harden architecture against Moltbot security model
...
- Discord: add allowed_users field + sender validation in listen()
- Slack: add allowed_users field + sender validation in listen()
- Webhook: add X-Webhook-Secret header auth (401 on mismatch)
- SecurityPolicy: add ActionTracker with sliding-window rate limiting
- record_action() enforces max_actions_per_hour
- is_rate_limited() checks without recording
- Gateway: print auth status on startup (ENABLED/DISABLED)
- 22 new tests (Discord/Slack allowlists, gateway header extraction,
rate limiter: starts at zero, records, allows within limit,
blocks over limit, clone independence)
- 554 tests passing, 0 clippy warnings
2026-02-13 15:31:21 -05:00
argenis de la rosa
05cb353f7f
feat: initial release — ZeroClaw v0.1.0
...
- 22 AI providers (OpenRouter, Anthropic, OpenAI, Mistral, etc.)
- 7 channels (CLI, Telegram, Discord, Slack, iMessage, Matrix, Webhook)
- 5-step onboarding wizard with Project Context personalization
- OpenClaw-aligned system prompt (SOUL.md, IDENTITY.md, USER.md, AGENTS.md, etc.)
- SQLite memory backend with auto-save
- Skills system with on-demand loading
- Security: autonomy levels, command allowlists, cost limits
- 532 tests passing, 0 clippy warnings
2026-02-13 12:19:14 -05:00