๐ Secrets & Network Security
Security is the most critical component of the Hoox trading platform. When deploying automated execution scripts, your capital and API credentials must be protected against malicious exploits, unauthorized webhook payloads, and network interceptions.
This guide outlines our Zero Trust security architecture, encrypted secret management procedures, and edge-level firewall protection runbooks.
๐ก๏ธ 1. Zero Trust Network Isolation
Traditional trading systems expose database and exchange execution APIs to the public internet (secured by simple HTTP headers or ports). This creates an active attack surface.
Hoox implements a strict Zero Trust microservice isolation topology:
[Public Internet] โโโโบ [Cloudflare WAF / Firewall]
โ
(IP & Auth Checks)
โ
โผ
[Gateway (hoox)] (Publicly Accessible Node)
โ
โโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
โ V8 Isolate Service Bindings โ
โ (Private, Encrypted, Zero-TCP) โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
[trade-worker] [d1-worker] [agent-worker]
(No Public URL) (No Public URL) (No Public URL)
โ โ โ
(Exchange Orders) (SQLite Queries) (AI Risk Audits)
- No Public Endpoints: The
trade-worker,d1-worker, andagent-workerliterally do not exist on the public internet. They have no public IP addresses or URLs. - V8 Service Bindings: Communication between the public gateway (
hoox) and internal compute nodes is routed entirely inside Cloudflareโs secure V8 engine isolates. Your trade routing data, database queries, and private logs never travel over the public internet, eliminating TLS decryption and packet-sniffing risks.
๐ 2. Encrypted Secret Management via CLI
API keys, exchange secrets, and Telegram bot tokens are never committed to git repositories or written in plain-text configuration files. Instead, they are stored directly on Cloudflareโs hardware-secured key vaults.
The Hoox CLI features deep encryption integrations to automate secret provisioning:
# 1. Inject a secure exchange credential (e.g. Bybit Secret)
hoox secrets set BYBIT_API_SECRET "your_private_signature_here"
# 2. Check the synchronization status of all required edge secrets
hoox secrets check
The Secrets Diagnostic Report
Running hoox secrets check queries Cloudflareโs API to confirm that the key binding exists on the edge, without ever exposing or decrypting the actual values in your terminal:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Cloudflare Edge Secrets Audit โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ BYBIT_API_KEY ........... โ
PRESENT (Active) โ
โ BYBIT_API_SECRET ........ โ
PRESENT (Active) โ
โ TELEGRAM_BOT_TOKEN ...... โ
PRESENT (Active) โ
โ OPENAI_API_KEY .......... โ ๏ธ MISSING (Optional) โ
โ โ
โ Audit Result: SECURE (All required secrets bound) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐งฑ 3. Webhook Firewall & TradingView IP Allow-listing
To ensure that only TradingViewโs official servers can fire signals to your /webhook gateway:
- Passkey Verification: The gateway checks the
apiKeyproperty inside the JSON payload against your secure manifest inCONFIG_KV. - Cloudflare WAF (Web Application Firewall): Since TradingView publishes their official IP ranges, you can configure Cloudflareโs edge firewall to block all webhook traffic that does not originate from these verified IPs.
# Auto-configure WAF rules to lock the /webhook route to TradingView IPs
hoox waf configure --TradingView-only
๐ 4. Security Best Practices Checklist
- Least Privilege API Keys: When creating API keys on Bybit, Binance, or MEXC, never enable โWithdrawalโ permissions. Only check โTradeโ and โAccount Readโ permissions.
- Credential Rotation: Automatically rotate your exchange API keys every 90 days. Deleting old keys and injecting new ones takes less than 60 seconds with
hoox secrets set. - Zero-Commit Rule: Verify that your
.env.localand.dev.varsfiles are registered in your workspaceโs.gitignorefile to prevent accidental pushes to public repos. - Emergency Response: If you suspect a strategy error or exchange anomaly, immediately halt all execution via the CLI:
hoox monitor kill-switch on
๐ Next Steps
- Astro Docs Site Config โ Map out your build-time environment configurations.
- Local Development & Testing โ Run local wrangler sandboxes with securely encrypted
.dev.vars.