Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
CORS reflects the request Origin on the public OAuth/MCP surface (/oauth/*, /.well-known/*, /mcp) for browser-based public clients. Credentials are never allowed — Bearer JWT + PKCE secures these endpoints, so no credentialed-origin allowlist is kept (unlike hilo). Other paths get no CORS headers.
func MaxBytes ¶
MaxBytes wraps r.Body in an http.MaxBytesReader so an oversized body fails at the ceiling instead of being fully buffered (or embedded on the /api path). Covers the /api JSON decode and /mcp streamable paths. n <= 0 disables the cap.
func RateLimit ¶
RateLimit is a token-bucket throttle keyed by the trusted client IP. rps is the sustained refill rate, burst the bucket size; over-limit requests get 429 + Retry-After. Probes are exempt. trustedProxyDepth controls X-Forwarded-For handling (see clientIP): 0 trusts none and keys on RemoteAddr. Outer abuse control over the auth/write surfaces; reads share the same bucket as defence in depth.
func SecurityHeaders ¶
SecurityHeaders sets the CSP plus nosniff/no-referrer on every response. Outermost layer, so 429/413/OPTIONS responses carry them too; defence in depth behind the UI's DOMPurify — even a sanitizer bypass can't load an off-origin script.
Types ¶
This section is empty.