Skip to content

Security Model

KubeGlass security model: OIDC authentication flow with per-user impersonation, HMAC-SHA256 sessions, and Kubernetes RBAC enforcement for mutations
LayerProtection
NetworkNetworkPolicy (deny all ingress by default), optional TLS
TransportHSTS, secure cookies, compression after ETag
AuthenticationOIDC / impersonation / local modes, HMAC-SHA256 sessions
AuthorizationKubernetes RBAC via user impersonation
Input validationK8s name validation, PromQL sanitization, body size limits
CSRFNon-simple header required for mutations
Rate limitingPer-IP token bucket (100/s, burst 200)
XSSCSP with nonces, security headers
SecretsNever logged, crypto/rand only
SessionRevocation deny-list, configurable TTL, HttpOnly/Secure/SameSite=Strict
ModeUse caseMechanism
localDevelopmentAll requests as "local-user" with "system:masters" group
oidcProductionJWT Bearer token validated against OIDC provider (JWKS refreshed periodically)
impersonationBehind proxyX-Forwarded-User / X-Forwarded-Groups from trusted proxies (CIDR allowlist)

All K8s mutations use user impersonation:

KubeGlass ServiceAccount
→ Impersonate-User: <userID>
→ Impersonate-Group: <group1>, <group2>
→ K8s API evaluates against user's RBAC rules

The service account needs impersonate verb on users and groups resources.

OperationClient usedReason
Create, delete, patch, exec, cordon, drainImpersonatedUser’s RBAC enforced
List, get, watchService accountFull cluster visibility for shared dashboards
Helm actionsImpersonatedHelm action config carries impersonation headers
WebSocket exec/streamsImpersonatedDynamic/stream clients with user headers
ThreatMitigation
Compromised kubeconfigCredential scrubbing after client init; tokens never logged; session-scoped storage
XSS / DOM injectionCSP nonce-based policy; HttpOnly/Secure/SameSite=Strict cookies
WebSocket hijackOrigin validation; name validation before watch/exec; per-user impersonation
PromQL injectionTwo-layer sanitization (regex reject + allowlist); 64KB/4096 char limits; 30-day range cap
Session fixationPer-tab sessionStorage; HMAC-SHA256 signing; server-side revocation
RBAC case confusionCase-insensitive subject matching with warn log on mismatch
Helm/exec bypassImpersonation headers on all Helm configs and exec REST configs
Denial of servicePer-IP rate limiting; paginated listing; batched pruning; bounded queues
Supply chaingo.sum + package-lock.json committed; govulncheck + npm audit in CI; Cosign + SLSA L3

All API boundary inputs are validated:

  • K8s names - validateK8sName() rejects names with path traversal, unicode tricks, or invalid characters
  • Namespaces - Same validation as resource names
  • PromQL - Two-layer sanitizer: regex blocklist + allowlist; size/complexity/time-range limits
  • WebSocket params - Name validation before watch/exec upgrade
  • Request bodies - Size limit (1 MiB default), JSON parsing with strict decoder
TimeoutValueRationale
ReadTimeout15sFull request read deadline
ReadHeaderTimeout5sSlowloris defense
WriteTimeout0WebSocket/SSE need indefinite lifetimes
IdleTimeout120sKeep-alive idle
MaxHeaderBytes1 MBHeader size limit

WriteTimeout is disabled at server level. REST API protection uses http.TimeoutHandler per-route (30s) for API endpoints specifically.