Security & Secrets Management¶
This document outlines the security model and secret management procedures for the Cloudflare worker.
1. Endpoint Protection¶
Protected by Default
All sensitive endpoints, including /llm/* and the development-only /rag/dev/*, are protected and require an API key.
- Mechanism: The worker expects an
x-api-keyheader on incoming requests to protected endpoints. - Shared Secret: The value of this header must match the
API_KEYsecret configured in the worker's environment.
2. Secret Rotation¶
To maintain security, the API_KEY secret should be rotated periodically or if a compromise is suspected.
Rotation Procedure¶
-
Generate a new secret:
-
Update the secret in Cloudflare: Run this command for each environment (
stage,prod). -
Update the secret in the Labeeb API: Update the
CF_WORKER_API_KEYvalue in the API's.envfile (or other secret management system). -
Reload the API Configuration: To apply the change without downtime, clear and recache the API's configuration.
Logging
Never log API keys, tokens, or raw user content in production logs. The worker and API should be configured to redact sensitive information.