🔒 Zero Trust & Security Hardening
While the Hoox dashboard features a highly secure, custom cookie-based authentication middleware, wrapping your dashboard and API endpoints inside Cloudflare® Zero Trust (Access) provides an enterprise-grade security perimeter.
By placing your deployment behind Cloudflare Access, you can enforce Multi-Factor Authentication (MFA), restrict access to specific GitHub/Google SSO identities, evaluate device posture, and drop malicious scanner payloads at the DNS level before they ever hit your workers.
🏗️ The Zero Trust Protective Boundary
graph TD
Client["🌐 Public Web Browser"] -->|Request| Gate["🧱 Cloudflare Edge<br/>WAF / Access Gate"]
Gate -->|MFA & GitHub SSO Validation| Dash["🖥️ Next.js Dashboard Isolate"]
style Client fill:#1e293b,stroke:#3b82f6,stroke-width:2
style Gate fill:#1e293b,stroke:#f59e0b,stroke-width:2
style Dash fill:#1e293b,stroke:#10b981,stroke-width:2
- Zero Public Exposure: The dashboard isolate does not evaluate public logins directly.
- MFA Gate: Users are intercepted by a secure Cloudflare authentication card at the nearest edge PoP.
- Zero Cost: Cloudflare’s Zero Trust free tier includes up to 50 users, which is more than enough for a personal algorithmic trading desk.
⚡ 1. Step-by-Step Dashboard Access Setup
Step 1: Enable Zero Trust on Your Account
- Log in to the Cloudflare Dashboard and click Zero Trust on the sidebar.
- If this is your first time, follow the onboarding prompts to register a unique Team Name (e.g.
alpha-trading.cloudflareaccess.com).
Step 2: Create a Self-Hosted Application
- In the Zero Trust dashboard, navigate to Access > Applications and click Add an application.
- Select Self-hosted.
- Application Name:
Hoox Dashboard Cockpit. - Session Duration: Select your preference (e.g.
24 Hoursto prevent constant login prompts). - Application Domain: Enter the custom domain mapped to your dashboard worker (e.g.,
hoox.my-trading-empire.com).
Step 3: Configure Authorization Policies
- Click Next to proceed to the Policies tab.
- Policy Name:
Allow Admin Only. - Action:
Allow. - Configure Rules:
- Include: Select Emails and enter your personal email address (enables Email OTP).
- Include (SSO): Alternatively, select GitHub Org/Teams or Google Workspace to enable SSO integrations.
- In the Require block, you can optionally require a valid security key (MFA) or device posture check (e.g. verifying that your laptop runs a specific OS version).
Step 4: Map Identity Providers & Save
- In Settings > Authentication, link your desired login providers (Google Workspace, GitHub OAuth, or Email OTP).
- Save the application.
- Open your browser and navigate to your custom domain (
https://hoox.my-trading-empire.com). You will be intercepted by your Cloudflare Access card. Once authorized, you are passed cleanly to your Next.js dashboard.
🧱 2. Strict WAF Webhook IP Allow-listing
To ensure that only TradingView’s official servers can fire signals to your /webhook entryway:
- Under your Cloudflare DNS zone dashboard, navigate to Security > WAF > Custom Rules.
- Click Create Rule.
- Rule Name:
Restrict /webhook to TradingView IPs. - Field:
URI Path| Operator:equals| Value:/webhook. - And:
IP Source Address| Operator:is not in| Value: (Paste TradingView’s official IP ranges here, which are automatically synced by running thehoox waf configure --TradingView-onlycommand). - Action: Block (or Challenge).
- Save. All unauthorized traffic hitting
/webhookis dropped instantly at the DNS edge, preventing any V8 compute load.
# Automated WAF setup via CLI
hoox waf configure --TradingView-only
⚙️ 3. Optional: Bypassing Local Dashboard Auth
Once your custom domain is wrapped inside Cloudflare Access, the dashboard’s built-in login form (DASHBOARD_USER, DASHBOARD_PASS) becomes redundant.
To streamline access:
- Edit the Next.js
middleware.tsfile insideworkers/dashboard/src/. - Toggle the authentication checker to leverage Cloudflare’s Access headers:
// Next.js Edge Middleware export function middleware(request: Request) { // Verify the JWT payload injected in headers by Cloudflare Access const cfAccessJwt = request.headers.get("Cf-Access-Jwt-Assertion"); if (cfAccessJwt) { // Cloudflare has already authenticated the session. Bypass local login. return NextResponse.next(); } // Fallback to local cookie checks... }
🔗 Next Steps
- Next.js Dashboard worker Profile — Review OpenNext compilation and asset bindings.
- System Observability & Metrics — Setup time-series logging and Analytics Engine tables.