Skip to content

feat(app): web-app run args + spored :443 proxy access-token gate (#590) - #600

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/590-web-proxy-auth
Sep 16, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/590-web-proxy-auth

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

The remaining #590 work (design approved): make built-in web catalog entries shippable + secure. Depends on libs v0.46.0 (the Args field), released.

Container run args

A web catalog entry can set args: (libs v0.46.0), or launch with repeatable --web-arg. The args are shell-quoted and appended to the web container's docker run (after the image, overriding CMD) — so images that default to binding container-localhost or requiring their own auth (code-server, Jupyter) can be told --bind-addr 0.0.0.0:<port> / run auth-less.

Proxy access-token gate

spored's :443 TLS reverse proxy now gates access with a one-time token, mirroring the DCV authToken model — so a web app is protected regardless of its own auth, and the world-open spawn-web SG (:443) is safe (the token is the gate, exactly like DCV's :8443):

  • spored generates a token, spawn:ready-url becomes https://<fqdn>/?spore_token=<t>.
  • webAuthHandler: ?spore_token (matching, constant-time) → sets a Secure; HttpOnly; SameSite=Lax cookie + 302 to the path sans token; a valid cookie → proxy pass-through (covers same-origin WebSocket upgrades); else 403.
  • --no-web-auth (WebAuth=none) disables the gate for apps with robust own auth → the gate becomes a pass-through and the ready-url carries no token.
  • The CLI opens the actual token-bearing spawn:ready-url from the tag.

Plumbing

LaunchConfig.WebAuth → tag spawn:web-auth → provider.Config.WebAuth; Agent.webToken generated once (reusing the DCV token pattern); buildWebUserData(..., args).

Tests

TestWebAuthHandler (403 / token→cookie+redirect / cookie-pass / wrong-cookie-403 / disabled-passthrough), TestBuildWebReadyURL (with/without token), buildWebUserData args shell-quoting. Full cmd/agent/aws/provider suites + vet green.

Not yet validated end-to-end

Gated follow-up (TTL + terminate + leak-check; needs the usual pre-release spored swap): launch code-server → reach ready, confirm ?spore_token loads it over TLS + WebSocket works, and dropping the token → 403. Then seed built-in web entries (libs) + cut a spawn release, closing #590.

Refs #590.

Catalog Args (+ --web-arg) are appended to the web container's docker run, so
images like code-server/Jupyter can bind 0.0.0.0 and run auth-less. spored's
:443 reverse proxy now gates access with a one-time token (mirrors DCV's
authToken): ready-url carries ?spore_token=<t> -> Secure/HttpOnly cookie ->
serve (incl. WebSockets); else 403. --no-web-auth opts out. Bumps libs v0.46.0.

Refs #590.
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.16667% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/agent/webready.go 65.90% 15 Missing ⚠️
cmd/app.go 36.36% 14 Missing ⚠️
pkg/aws/tags.go 0.00% 1 Missing and 1 partial ⚠️
pkg/provider/ec2.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

…Semgrep findings

Docs drift gate: docs-gen/app.md for the two new flags. Semgrep: the proxy
redirect is a relative same-origin path (token param stripped) — not an open
redirect; the test cookies are request cookies simulating a browser send, where
HttpOnly/Secure don't apply. Justified nosemgrep on each.
@scttfrdmn
scttfrdmn merged commit 2559571 into main Sep 16, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/590-web-proxy-auth branch September 16, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant