Skip to content

Commit fdcf84c

Browse files
authored
Merge pull request #6 from commandlayer/claude/review-runtime-repo-oDcvb
feat: complete runtime for production exposure
2 parents 5004674 + 5084c69 commit fdcf84c

File tree

3 files changed

+1646
-1612
lines changed

3 files changed

+1646
-1612
lines changed

docs/CONFIGURATION.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Comma-separated list of enabled handlers. Disabled verbs return `404`.
2626
|---|---|---|
2727
| `RECEIPT_SIGNER_ID` | `runtime` (or `ENS_NAME` when set) | Receipt proof signer identifier. |
2828
| `RECEIPT_SIGNING_PRIVATE_KEY_PEM_B64` | empty | Required for signing receipts. Base64 of PEM private key. |
29-
| `RECEIPT_SIGNING_PUBLIC_KEY` | empty | Optional local verifier pubkey text in `ed25519:<base64>` format for `/verify`. |
29+
| `RECEIPT_SIGNING_PUBLIC_KEY_PEM_B64` | empty | Public key for `/verify` (base64-encoded PEM). |
30+
| `RECEIPT_SIGNING_PUBLIC_KEY_PEM` | empty | Public key for `/verify` (plain PEM text). Either this or the B64 variant is sufficient. |
3031
| `ENS_NAME` | empty | Optional identity alias fallback. |
3132

3233
## ENS-based verification
@@ -47,6 +48,7 @@ Comma-separated list of enabled handlers. Disabled verbs return `404`.
4748
| `SCHEMA_FETCH_TIMEOUT_MS` | `15000` | Timeout per schema document fetch. |
4849
| `SCHEMA_VALIDATE_BUDGET_MS` | `15000` | Budget for async schema compilation. |
4950
| `VERIFY_SCHEMA_CACHED_ONLY` | `1` | If `1`, `/verify?schema=1` only uses warm validators and returns `202` on cold cache. |
51+
| `REQUEST_SCHEMA_VALIDATION` | `0` | If `1`, validate verb request payloads against published request schemas. Returns `503` if schemas are unavailable. |
5052

5153
## Cache controls
5254

@@ -73,6 +75,35 @@ Comma-separated list of enabled handlers. Disabled verbs return `404`.
7375
| `ENABLE_SSRF_GUARD` | `1` | Enables DNS/IP/local-network SSRF checks. |
7476
| `ALLOW_FETCH_HOSTS` | empty | Optional CSV domain allowlist (`example.com,api.example.com`). |
7577

78+
## CORS
79+
80+
| Variable | Default | Purpose |
81+
|---|---|---|
82+
| `CORS_ALLOW_ORIGINS` | empty | Comma-separated list of allowed origins. Empty = deny browser-origin requests. Use `*` to allow all (not recommended in production). |
83+
| `CORS_ALLOW_HEADERS` | `Content-Type, Authorization` | Allowed request headers. |
84+
| `CORS_ALLOW_METHODS` | `GET,POST,OPTIONS` | Allowed HTTP methods. |
85+
86+
## Debug routes
87+
88+
| Variable | Default | Purpose |
89+
|---|---|---|
90+
| `DEBUG_ROUTES_ENABLED` | `0` | If `1`, enables `/debug/*` endpoints. Disabled by default in production. |
91+
| `DEBUG_BEARER_TOKEN` | empty | If set, requires `Authorization: Bearer <token>` on all debug routes. |
92+
93+
## Request logging
94+
95+
| Variable | Default | Purpose |
96+
|---|---|---|
97+
| `LOG_REQUESTS` | `1` | If `1`, emits structured JSON log lines to stdout for every request. |
98+
99+
## Rate limiting
100+
101+
| Variable | Default | Purpose |
102+
|---|---|---|
103+
| `RATE_LIMIT_ENABLED` | `0` | If `1`, enables per-IP rate limiting. |
104+
| `RATE_LIMIT_MAX` | `120` | Max requests per window per IP. |
105+
| `RATE_LIMIT_WINDOW_MS` | `60000` | Sliding window duration in milliseconds. |
106+
76107
## Schema prewarm behavior
77108

78109
| Variable | Default | Purpose |
@@ -83,8 +114,11 @@ Comma-separated list of enabled handlers. Disabled verbs return `404`.
83114

84115
## Recommended production baseline
85116

86-
- Set explicit signing keys and verify `signer_ok=true` on `/health`.
117+
- Set explicit signing keys and verify `signer_ok=true` and `verifier_ok=true` on `/health`.
87118
- Keep `VERIFY_SCHEMA_CACHED_ONLY=1` for edge stability.
119+
- Set `CORS_ALLOW_ORIGINS` to specific origins (never `*` in production).
120+
- Set `DEBUG_ROUTES_ENABLED=0` (default) or protect with `DEBUG_BEARER_TOKEN`.
121+
- Set `RATE_LIMIT_ENABLED=1` with appropriate limits for your traffic profile.
88122
- Restrict egress using both network policy and `ALLOW_FETCH_HOSTS` where possible.
89123
- Tune `FETCH_MAX_BYTES` and timeout budgets based on expected payload sizes.
90124
- Poll `/debug/validators` after deploy and prewarm critical verbs.

0 commit comments

Comments
 (0)