Lightweight, zero-trust reverse proxy worker for APIs. Deploy anywhere on Cloudflare. 100% Standalone & Open Source.
GATE is a standalone, lightweight Cloudflare Worker reverse proxy that enforces zero-trust security for Building Management Systems (BMS), PropTech, and general HTTP APIs.
It runs directly at Cloudflare's edge network with zero external dependencies, zero database requirements, and zero vendor lock-in.
- 🛡️ 100% Standalone: No external SaaS, database, or proprietary backend required.
- ⚡ Sub-Millisecond Latency: Runs on Cloudflare's global V8 isolate network.
- 🔑 Bearer Token Auth: Enforces API key verification at the edge.
- 📋 Default-Deny Whitelisting: Strict command and parameter schema validation.
- 🧪 Parameter Validation: Type checks, regex patterns, min/max ranges, string length limits, and enum enforcement.
- 🚫 Multi-Layer Threat Filtering: Auto-blocks SQL injection, OS command injection, script injection (XSS), and prompt injection.
- 🪤 Honeypot Mode (Optional): Can return deceptive canary-trap payloads and trigger security alert webhooks to any custom endpoint (SIEM, Slack, Discord).
GATE sits between your client application and your upstream destination API:
Client Application ──POST──▶ GATE (Cloudflare Edge Worker) ──▶ Upstream Destination API
│ 1. CORS Preflight (OPTIONS -> 200 OK)
│ 2. Method Validation (POST only)
│ 3. Bearer Token Authentication
│ 4. Schema Whitelist & Bounds Check
│ 5. Threat Pattern Filtering
│ 6. Forward Payload to Target URL
- CORS Preflight: Responds automatically to
OPTIONSpreflight checks with correct CORS headers. - Method Validation: Only accepts
POSTrequests. All other methods receive405 Method Not Allowed. - Authentication: Verifies
Authorization: Bearer <key>against yourGATE_API_KEY. Unauthenticated requests receive401 Unauthorized. - Schema Enforcement: Validates that incoming
commandandparamsmatch your configured whitelist ingate.config.json. Invalid or unknown parameters receive403 Forbidden. - Threat Detection: Scans request contents for injection attacks. Detected threats receive
403 Forbidden. - Clean Proxying: Strips routing metadata and streams sanitized
{ command, params }payloads directly totarget_url.
git clone https://github.com/DentiSystems-HQ/gate.git
cd gate
npm installCreate a .dev.vars file in the project root for local testing:
GATE_API_KEY=your-secret-api-keynpm run devThe gateway will start locally at http://localhost:8787.
curl -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-api-key" \
-d '{
"target_url": "https://api.example.com/bms/endpoint",
"command": "get_property_details",
"params": {
"property_id": "prop_101"
}
}'- GATE checks
Authorizationheader. - GATE validates that
get_property_detailsis whitelisted. - GATE checks that
property_idis a string, max length 50, and matches^[a-zA-Z0-9_-]+$. - GATE scans for threat patterns.
- GATE strips
target_urlfrom payload and forwards{ "command": "get_property_details", "params": { "property_id": "prop_101" } }tohttps://api.example.com/bms/endpoint.
Commands and parameter validation rules are defined in gate.config.json:
{
"version": "1.1.0",
"security_mode": "STRICT_BLOCK",
"commands": {
"update_hvac_setpoint": {
"description": "Update HVAC temperature setpoint",
"parameters": {
"device_id": {
"type": "string",
"required": true,
"max_length": 50,
"pattern": "^[a-zA-Z0-9_-]+$"
},
"temperature_celsius": {
"type": "number",
"required": true,
"min": -50,
"max": 50
}
}
}
}
}| Rule | Type | Description |
|---|---|---|
type |
"string" | "number" | "boolean" |
Mandatory JSON data type |
required |
boolean |
Rejects request if parameter is missing |
max_length |
number |
Maximum allowed length for strings |
min / max |
number |
Minimum and maximum limits for numbers |
pattern |
string |
Regex pattern that string values must strictly match |
enum |
array |
Whitelist of exact permitted values |
GATE supports two security modes defined in gate.config.json:
Directly drops invalid/malicious requests and returns an HTTP status code (401, 403, 405).
Instead of returning 403 Forbidden, GATE returns a synthetic 200 OK response populated with canary markers (SECURITY_CANARY_...). Optionally dispatches a webhook alert to webhook_alert_url (SIEM, Slack, custom webhook).
GATE includes an automated integration test suite validating all 6 security layers:
# Terminal 1: Run local dev server
npm run dev
# Terminal 2: Execute integration tests
npm run testDeploy GATE to Cloudflare Workers with Wrangler:
# 1. Authenticate with Cloudflare
npx wrangler login
# 2. Set production API key secret
npx wrangler secret put GATE_API_KEY
# 3. Deploy
npm run deployDistributed under the MIT License. See LICENSE for details.
Maintained by DentiSystems