This review covers the HTTP bridge, request validation, authentication, rate limiting,
and the cloud fallback adapter on implementation/v1.0.1-foundation.
- Bearer-token authentication uses a length check and
timingSafeEqual. - The request body is capped at 64 KiB while it is streamed.
- Request fields are allow-listed and individual text/session fields have limits.
- Provider failures are returned to clients as a generic 502 response.
- Prompt contents and credentials are not written to application logs.
- Responses use
Cache-Control: no-storeandX-Content-Type-Options: nosniff. - Cloud fallback requires the explicit
NEED_CLOUDmarker. - The OpenAI adapter uses a 25-second timeout and does not expose provider error bodies.
- The server now accepts a
RateLimiterdependency whosecheckmethod may be asynchronous. - Trusted reverse-proxy handling is opt-in through
trustedProxies; untrusted forwarded headers cannot override the TCP peer used for rate limiting. - Added a provider-neutral shared limiter adapter. It hashes client keys before storage and requires a backend-provided atomic increment with first-write expiry. This permits a host-specific shared/atomic store without making Redis or another vendor a mandatory dependency. The in-memory implementation remains the default for a single process.
- The JSON media type is checked exactly after removing optional parameters; values such as
application/jsonpare rejected. - The in-memory limiter now validates finite window sizes and integer key limits.
- The HTTP server applies 10-second header, 30-second request, and 5-second keep-alive timeouts.
- A rate-limiter backend failure now returns a generic 503 response instead of leaving the request unresolved.
- CI now uses the committed lockfile with
npm ciand has read-only repository contents permission. - Rate-limit tests cover concurrent checks and isolation between client keys.
- The default in-memory limiter is process-local. Multiple server instances must inject the
createSharedRateLimiteradapter with anAtomicRateLimitStoreimplementation that performs increment and first-write expiry atomically across instances. The repository does not bundle or mandate Redis or another storage provider. - Rate-limit identity uses the TCP peer address by default;
X-Forwarded-Foris ignored. The optionaltrustedProxiesallow-list accepts exact IPs/CIDRs. Forwarded chains are considered only when the direct TCP peer is trusted, are traversed right-to-left, and fall back to the TCP peer when malformed or longer than 20 hops. Configure only actual proxy egress addresses and prevent direct access that bypasses the proxy. - Terminate HTTPS at a trusted hosting platform or reverse proxy. This Node server does not configure TLS itself.
- Store
BRIDGE_TOKENandOPENAI_API_KEYin the host's secret manager; rotate them if exposed. Never commit live credentials or place them in Shortcut URLs. - Apply platform-level connection limits and an overall concurrency limit before public deployment; application-level HTTP timeouts do not replace edge/proxy connection controls.
- The health endpoint is intentionally unauthenticated and returns only service status.
- A successful source review and CI run are not a penetration test or a production security certification.
The code keeps gpt-6-luna as its default. Confirmed against the current OpenAI API model
catalog/pricing documentation on 2026-12-04. Deployments may override it with OPENAI_MODEL.