Skip to content

Repository files navigation

QuickStack Auth Proxy

QuickStack Auth Proxy is a small Go reverse proxy that protects certain QuickStack services with a signed, one-time access token.

It is intended to sit behind an ingress or forward-auth setup. A client first opens a sandbox URL containing ?token=<JWT>. The proxy validates that token, stores the authenticated sandbox identity in a secure session cookie, removes the token from the URL, and redirects the client back to the same page. Later requests use the session cookie and are proxied to the sandbox service in the Kubernetes cluster.

The proxy routes regular application traffic to the required port claim in the access token. Paths beginning with /files always use port 80, regardless of that claim, on:

<claimId>.<namespace>.svc.cluster.local

Authentication behavior

Access tokens must be HS256 JWTs signed with AGENT_JWT_SECRET. They must use the issuer QuickStack-auth-proxy, have a unique JWT ID (jti), an expiry (exp), and the following claims:

ClaimPurpose
agentIdAgent identifier
claimIdSandbox service name
namespaceKubernetes namespace containing the sandbox
portRequired. Target port for all routes except /files; must be from 1 through 65535.

This is a breaking change: the QuickStack component that issues access tokens must include the numeric port claim. Access tokens (and existing session cookies) without a valid port are rejected.

Each access token can be exchanged only once while this proxy process is running. Replay tracking and session-signing keys are held in memory, so use a single replica unless you add shared storage and a shared session secret. A restart invalidates existing sessions and resets access-token replay tracking.

The session cookie is HttpOnly, Secure, and SameSite=None; deploy it behind HTTPS. The proxy removes its own session cookie, the Authorization, X-Forwarded-Uri, Origin, and Referer headers before proxying requests.

Configuration

VariableDefaultDescription
AGENT_JWT_SECRETnoneRequired in production. Shared secret used to verify incoming HS256 access tokens. Keep it in a secret manager or Kubernetes Secret. Requests with access tokens fail if it is unset.
PORT3000TCP port on which the proxy listens.
AGENT_SESSION_JWT_TTL_SECONDS3600Lifetime, in seconds, for the session JWT stored in the cookie. Invalid or non-numeric values fall back to 3600.
AUTH_PROXY_DEBUG_ENABLEDfalseSet to exactly true to return and log a redacted JSON diagnostic when a request containing an invalid access token is rejected. Successful token redirects additionally log the internal target host and port. This exposes cluster topology; do not enable in normal production operation.
AGENT_ACCESS_TOKEN_TTL_SECONDS60Reported by debug diagnostics. It does not currently change access-token validation or issuance; token expiry is determined by the access token's exp claim. Invalid, empty, or non-positive values are reported as 60.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages