Cosy Redact Gateway assumes the selected upstream may store or inspect everything it receives. The relay therefore edits supported JSON request text before the upstream fetch and only keeps the plaintext/token mapping in memory for the lifetime of that request.
It does not attempt to make a malicious upstream trustworthy. It only reduces accidental disclosure of values recognized by the configured detectors.
- Set
REDACT_ALLOWED_HOSTSunless arbitrary upstream routing is an explicit requirement. - Protect public deployments with your platform's authentication/rate limiting if they should not be open relays.
- Keep
REDACT_MAX_BODY_BYTESandREDACT_MAX_REDACTIONSbounded. The shipped defaults are 16 MiB and 16384 respectively; lower them on memory-constrained deployments. - Do not log request bodies, upstream bodies, or the per-runtime salt in surrounding infrastructure.
- Keep redirects disabled. The implementation uses
redirect: "manual"so an upstream cannot redirect the forwarded API key to a second origin. - Treat URL-embedded upstream query parameters as visible routing metadata. Secrets should normally remain in forwarded authorization headers, not the proxy URL.
- Review
docs/GITLEAKS-COMPAT.mdbefore relying onGas an exact Gitleaks replacement.
Authorization/provider headers are preserved, while hop-by-hop and relay identity/session headers are removed. In particular the proxy drops Cookie, CF-*, Sec-*, Forwarded, X-Forwarded-*, X-Real-IP, and similar headers before the upstream fetch.
The salt is generated once when a Worker/Deno isolate starts. Multiple concurrent isolates may therefore use different salts. Restoration does not depend on cross-request or cross-instance state: each response stream closes over its own request-local mapping.