Skip to content

Commit 663fa5e

Browse files
committed
fix(deploy): corrects wirefilter syntax, updates WAF tests
- starts_with() is a function, not an infix operator in CF expressions - WAF smoke tests send Origin header for API endpoint tests - Adds Origin gate tests (no Origin → 403, wrong Origin → 403) - Removes stale --ci flag reference from verify configuration note
1 parent 9dd9fcb commit 663fa5e

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

DEPLOY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ PAT instead), and Turnstile is only used by the planned Jira integration.
6767

6868
**Verify configuration:** Run `pnpm validate:deploy` locally to check that all required
6969
Cloudflare Worker secrets are set. In CI, the deploy workflow runs
70-
`pnpm validate:deploy --ci` automatically before building.
70+
`pnpm validate:deploy` automatically before building.
7171

7272
### Optional (both deployment paths)
7373

@@ -230,7 +230,7 @@ Configure these rules in the Cloudflare dashboard under **Security → WAF**.
230230
**Where:** Security → WAF → Custom Rules
231231
**Expression:**
232232
```
233-
(http.request.uri.path starts_with "/api/") and
233+
(starts_with(http.request.uri.path, "/api/")) and
234234
not (any(http.request.headers["origin"][*] in {"https://YOUR-DOMAIN"})) and
235235
not (http.request.uri.path eq "/api/csp-report") and
236236
not (http.request.uri.path eq "/api/error-reporting")
@@ -251,7 +251,7 @@ not (http.request.uri.path eq "/api/error-reporting")
251251
**Where:** Security → WAF → Rate Limiting Rules
252252
**Matching expression:**
253253
```
254-
(http.request.uri.path starts_with "/api/") and
254+
(starts_with(http.request.uri.path, "/api/")) and
255255
(http.request.method ne "OPTIONS")
256256
```
257257
**Rate:** 60 requests per 10 seconds per IP

scripts/waf-smoke-test.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ TESTS=(
5858
"200|GET /privacy|${BASE}/privacy"
5959
"307|GET /index.html (html_handling redirect)|${BASE}/index.html"
6060
"200|GET /assets/nonexistent.js|${BASE}/assets/nonexistent.js"
61-
"200|GET /api/health|${BASE}/api/health"
62-
"400|POST /api/oauth/token (no body)|-X|POST|${BASE}/api/oauth/token"
63-
"404|GET /api/nonexistent|${BASE}/api/nonexistent"
61+
"200|GET /api/health (with Origin)|-H|Origin: ${BASE}|${BASE}/api/health"
62+
"400|POST /api/oauth/token (no body)|-X|POST|-H|Origin: ${BASE}|${BASE}/api/oauth/token"
63+
"404|GET /api/nonexistent|-H|Origin: ${BASE}|${BASE}/api/nonexistent"
64+
# Rule 3: Origin gate — API requests without valid Origin are blocked at WAF
65+
"403|GET /api/health (no Origin)|${BASE}/api/health"
66+
"403|POST /api/oauth/token (wrong Origin)|-X|POST|-H|Origin: https://evil.example.com|${BASE}/api/oauth/token"
6467
# Rule 1: Path Allowlist — blocked paths
6568
"403|GET /wp-admin|${BASE}/wp-admin"
6669
"403|GET /wp-login.php|${BASE}/wp-login.php"

0 commit comments

Comments
 (0)