Threat model
Weft строится против background-agent threat landscape описанного в Background Agent Summit (ONA, 2026). Ключевая идея:
«Prompt — не security boundary.»
Caller agent compromise possible через prompt injection в tool description, в данных возвращаемых downstream API, или в системных command'ах. Защиту нельзя строить на доверии к agent reasoning.
Defense in depth — 5 слоёв
- JWT capability scoping — tools allowlist, max_per_call_usdc, max_session_usdc, expires_at. Подписан вне agent'а. Default = empty allowlist.
- On-chain allowance — WeftEscrow V2
allowancePerTool[tenant][toolId][sessionId]на Base Sepolia. Userspace obхода нет. Адрес: 0xE8Ee...E0ce. - Rate limiting — 60 req/min/IP, BullMQ-backed quotas, Redis-cached counters.
- Anomaly detection — webhook-event watcher, escalation на abnormal patterns (10+ calls на 10+ tools за 60s от одного session-token → auto-cap).
- Tamper-evident ledger — HMAC-SHA256 на каждом ledger entry. Manual DB tampering детектируется.
Manifest signing
Каждый зарегистрированный сервис имеет:
manifest_hash= SHA256({id, title, description, price_usdc, params_schema}) — проверяется на каждыйenable_x402. Tampering →MANIFEST_TAMPERINGerror.manifest_signature(опционально) — EIP-712 подпись провайдера. Verified-badge в /marketplace.
Description sanitization
Перед сохранением description провайдера, применяется regex sanitizer:
- Адреса
0x[40 hex]→[blocked: address](anti address-injection) - Urgency-фразы (urgent / asap / expires in / now) →
[blocked: urgency] - Imperative verbs на старте (send / transfer / approve / execute) →
[blocked: imperative] - HTML-теги — strip
Infrastructure
- HTTPS via Let's Encrypt TLS 1.3 (Caddy)
- HD master mnemonic — file mode 0600, root only, никогда не передаётся по wire
- Daily encrypted backups (AES-256 GPG symmetric)
- PM2 systemd-managed weft-pay process
- Postgres + Redis on isolated network
Smart contract security
WeftEscrow V1 (0xacb59..., V0.4) и V2 (0xE8Ee5Da..., V0.5) — open-source, Hardhat tested 57/57. НЕ аудированы independent firm в V0.x. Trail of Bits audit запланирован Q3 2026 перед mainnet launch.
Operator role — multisig в V1+ (сейчас single key). Pause-функция доступна owner'у в случае критической уязвимости.
Vulnerability disclosure
Если ты нашёл уязвимость:
- НЕ exploit на mainnet (after mainnet launch).
- Создай private security advisoryна GitHub.
- Включи: PoC, affected version, reproduction steps, expected vs actual behavior.
- Жди ответ в течение 48 часов.
Bug bounty
Bug bounty программа планируется после mainnet launch + Trail of Bits audit completion. Ожидаемый payout range: $500 (informational) до $50,000 (critical economic attacks). Programme TBA через GitHub announcement.
Past incidents
На момент V0.5 — security incidents с user fund loss не было. Public log incident'ов — в docs/incidents.md на GitHub после первого инцидента.
Contact
Security advisories: github.com/holasergio/weft/security.