GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - biersoeckli/QuickStack-auth-proxy

BranchesTags
Open more actions menu

Latest commit

 

History

29 Commits
29 Commits

Folders and files

NameName
Last commit message
Last commit date
.devcontainer
.devcontainer
 
 
.github/workflows
.github/workflows
 
 
internal
internal
 
 
.dockerignore
.dockerignore
 
 
Dockerfile.amd64
Dockerfile.amd64
 
 
Dockerfile.arm64
Dockerfile.arm64
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 
main_test.go
main_test.go
 
 

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:

Claim Purpose
agentId Agent identifier
claimId Sandbox service name
namespace Kubernetes namespace containing the sandbox
port Required. Target port for all routes except /files; must be from 1 through 65535.
type Optional for the browser flow. Must be api for direct bearer-token API/WebSocket access.

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.

API and WebSocket bearer tokens

In addition to the browser flow, the proxy accepts reusable access tokens carried as X-QS-Proxy-Authorization: Bearer <JWT> when the token has the custom claim "type": "api". Such requests are routed directly to the sandbox target; there is no token-to-session exchange, no redirect, and no session cookie.

  • API tokens are reusable and not tracked for replay; they are only bounded by their exp claim. Because they do not rely on process-local state, they also work across multiple replicas.
  • type must be exactly api; a malformed, expired, invalid, or wrong-type proxy credential is rejected with 407 Proxy Authentication Required and Proxy-Authenticate: Bearer.
  • type: "api" tokens are rejected by the browser ?token= exchange, and browser access tokens (no/other type) are rejected as bearer tokens.
  • The port claim is always used, including for /files paths, so API tokens can never be routed to the /files port (80).
  • Authorization, Origin, and Referer are passed to the target unchanged, in both modes. X-QS-Proxy-Authorization is always removed before proxying.
  • WebSocket upgrades are proxied transparently; the bearer token is validated during the handshake.

The X-QS-Proxy-Authorization header must reach the proxy; if forward-auth is configured, make sure the ingress forwards it. For example:

curl -H "X-QS-Proxy-Authorization: Bearer $TOKEN" https://<proxy-host>/path

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, X-QS-Proxy-Authorization, and X-Forwarded-Uri before proxying requests.

Configuration

Variable Default Description
AGENT_JWT_SECRET none Required 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.
PORT 3000 TCP port on which the proxy listens.
AGENT_SESSION_JWT_TTL_SECONDS 3600 Lifetime, in seconds, for the session JWT stored in the cookie. Invalid or non-numeric values fall back to 3600.
AUTH_PROXY_DEBUG_ENABLED false Set 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_SECONDS 60 Reported 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

Readme
GPL-3.0 license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.