Skip to content

fix(packaging): compose eval stack proxies auth in-network and bootstraps a first admin - #4768

Merged
yomgui merged 2 commits into
devfrom
fix/compose-eval-auth-proxy-first-admin
Sep 10, 2026
Merged

yomgui merged 2 commits into
devfrom
fix/compose-eval-auth-proxy-first-admin

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member

Problem

Two gaps in the documented pull-only evaluation stack (packaging/docker/docker-compose.eval.yml, packages/docs/self-host/evaluate-with-docker-compose.mdx):

F2 — auth proxy upstream. den-web's /api/auth/* route is a server-side proxy that reads DEN_API_BASE (ee/apps/den-web/app/api/_lib/upstream-proxy.ts). With DEN_API_BASE=http://localhost:<OPENWORK_API_PORT> — the shape the stack shipped with until #4729 — the web container cannot reach the upstream and answers 502 upstream_unreachable. That breaks every web-origin auth URL Den advertises: the SAML ACS URL (/api/auth/sso/saml2/sp/acs/...), the SCIM base URL (/api/auth/scim/v2), and the /setup page's account creation (POST /api/auth/sign-up/email). #4729 already moved the pin to http://den:8788; this PR documents why in the file so the next edit does not regress it, and drops DEN_AUTH_FALLBACK_BASE, which den-web has not read since 2026-07-08 (no .ts reference in ee/apps/den-web; removed from the den-web README too).

F5 — first administrator on Compose. first-administrator.mdx was Helm-only and the compose file did not pass DEN_SINGLE_ORG_OWNER_EMAILS / DEN_INITIAL_ADMIN_BOOTSTRAP_CODE through, so OPENWORK_ALLOW_SIGNUP=false left no way to create the first account.

Change

Proof

Config/docs change; runtime proof is the stack boots below (published 0.18.46 images, OPENWORK_WEB_PORT=13005 OPENWORK_API_PORT=18788), not a testkit spec.

F2 negative — current compose + override DEN_API_BASE=http://localhost:18788 (the pre-#4729 shape), from the host:

$ curl -si http://localhost:13005/api/auth/ok
HTTP/1.1 502 Bad Gateway
{"error":"upstream_unreachable","message":"The upstream service could not be reached.","referenceId":"1142514c-…"}
$ curl -si http://localhost:13005/api/auth/get-session   → HTTP/1.1 502 Bad Gateway

F2 positive — this branch's compose:

$ curl -si http://localhost:13005/api/auth/ok
HTTP/1.1 200 OK … {"ok":true}
$ curl -si http://localhost:13005/api/auth/get-session   → HTTP/1.1 200 OK … null
$ curl -s  http://localhost:13005/api/ready              → {"ok":true,"service":"den-web","checks":{"configuration":"ok","upstream":"ok"}}
web-1 | {"route_prefix":"/api/auth","method":"GET","upstream_origin":"http://den:8788","upstream_path":"/api/auth/ok","status":200,…}
web:   DEN_AUTH_FALLBACK_BASE=<unset>

F5 — booted with OPENWORK_ALLOW_SIGNUP=false [email protected] OPENWORK_SETUP_CODE=<random>; the sequence /setup drives (ee/apps/den-web/app/(den)/setup/page.tsx), verify on the API origin and sign-up through the web-origin proxy:

GET  :18788/v1/auth/bootstrap/status                                   → {"status":"available"}
POST :13005/api/auth/sign-up/email  (allowlisted, no grant)            → 403 single_org_signup_disabled
POST :18788/v1/auth/bootstrap/verify ([email protected], good code) → 403 bootstrap_verification_failed
POST :18788/v1/auth/bootstrap/verify ([email protected], wrong code)   → 403 bootstrap_verification_failed
POST :18788/v1/auth/bootstrap/verify ([email protected], good code)    → 200 {"grant":"ow_bootstrap_…","expiresAt":…}
POST :13005/api/auth/sign-up/email  ([email protected] + grant)     → 403 bootstrap_verification_failed
POST :13005/api/auth/sign-up/email  ([email protected] + grant)        → 200 (session cookie set)
GET  :18788/v1/auth/bootstrap/status                                   → {"status":"complete"}
POST :18788/v1/auth/bootstrap/verify ([email protected], good code)    → 409
GET  :13005/api/auth/get-session (cookie)                              → user [email protected], activeOrganizationId set
mysql> select m.role, o.slug from member m join organization o …       → owner  default
mysql> select email, note from admin_allowlist                         → [email protected]  Initial administrator bootstrap
GET  :13005/setup                                                      → 200, data-testid="initial-admin-setup"

Docs (the validate-docs CI lane, run locally in packages/docs): npx -y [email protected] validate → build validation passed; npx -y [email protected] broken-links → no broken links found.

Download pin: curl …/79636623bfbed3e2e5daff48b8550cb2ba220d77/packaging/docker/docker-compose.eval.yml | shasum -a 256 --check → docker-compose.eval.yml: OK.

Warden (pnpm warden:check, HEAD a01761540, origin/dev 634df629a before and after): diff-security-review + confidentiality-review both completed, No findings, exit 0.

Not fixed here (den-web code, needs an image release)

/api/den/* is a 307 redirect (app/api/_lib/den-api-redirect.ts → denApiOriginForWebOrigin) and it prefers DEN_API_BASE over DEN_API_PUBLIC_URL. With the in-network DEN_API_BASE the browser is sent to location: http://den:8788/…, which is unreachable from the host; Helm has the same shape (DEN_API_BASE=http://<release>-den-api:8788). The pre-#4729 config redirected correctly but 502'd the proxy — the two envs cannot satisfy both today. Fix belongs in den-web (den-api-origin.ts + next-config-den-api-redirects.cjs: prefer DEN_API_PUBLIC_URL, then DEN_API_BASE, then api.<host>); the route only serves older desktop builds, runtime-config already hands new clients denApiUrl=http://localhost:18788.

…raps a first admin

den-web's /api/auth/* proxy (SSO ACS, SCIM, /setup account creation) reads
DEN_API_BASE server-side; pointing it at the host-only localhost:<API_PORT>
answered 502 upstream_unreachable from inside the web container. Keep the
in-network http://den:8788 with a comment saying why, and drop
DEN_AUTH_FALLBACK_BASE, which den-web has not read since 2026-07-08.

Pass DEN_SINGLE_ORG_OWNER_EMAILS and DEN_INITIAL_ADMIN_BOOTSTRAP_CODE through
to the den service as OPENWORK_OWNER_EMAILS / OPENWORK_SETUP_CODE (empty keeps
the public-signup default) and document the Compose path of the
first-administrator flow next to the Helm one.
@mintlify

mintlify Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
differentai 🟢 Ready View Preview Sep 10, 2026, 4:39 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 10, 2026 4:38am UTC
openwork-den Ready Ready Preview Sep 10, 2026 4:38am UTC
openwork-diagnostics Ready Ready Preview Sep 10, 2026 4:38am UTC
openwork-landing Ready Ready Preview, v0 Sep 10, 2026 4:38am UTC

@github-actions

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (40141 ms), confidentiality-review (45549 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 1
  • Distinct heads in retained window: 1
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 1/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (a01761540ecc6b4179585e19bc617b657f7e7aa7). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@github-actions

Copy link
Copy Markdown
Contributor

Passed · 6/6 tests · 7/7 assertions · 5 images

Commit a01761540ecc6b4179585e19bc617b657f7e7aa7 · selected evidence

Open review report

@yomgui
yomgui merged commit 7d5097d into dev Sep 10, 2026
37 checks passed
@yomgui
yomgui deleted the fix/compose-eval-auth-proxy-first-admin branch September 10, 2026 04:44
yomgui added a commit that referenced this pull request Sep 10, 2026
… not the in-network DEN_API_BASE (#4793)

Follow-up to #4768. den-web's legacy /api/den/* 307 (older desktop builds)
resolved its Location from DEN_API_BASE first. In the documented Compose and
Helm shapes DEN_API_BASE is the container-internal upstream the /api/auth/*
proxy needs (http://den:8788), so browsers were redirected to a host they
cannot reach. Prefer DEN_API_PUBLIC_URL, the browser-reachable origin that
runtime-config already hands to new clients, then fall back to DEN_API_BASE,
then api.<web host>, in both the route handler and its build-time mirror.
The runtime side now also rejects non-http(s) schemes like the mirror did,
so a scheme-less value no longer produces a "null" origin.

The /api/auth/* proxy, readiness and the SSO probe keep reading DEN_API_BASE.

Proof: extended den-web unit tests (route, origin, build-time parity) and a
new PR-lane spec, evals/specs/den-web-public-api-redirect.test.ts, that boots
the documented docker-compose.eval.yml as an isolated project with a locally
built den-web image (OPENWORK_EVAL_DEN_WEB_IMAGE) and asserts from the host
that the redirect lands on Den API health, the auth proxy still answers
through the in-network upstream, runtime-config agrees with the redirect,
and the same image without DEN_API_PUBLIC_URL keeps the DEN_API_BASE fallback.

This branch was successfully deployed

5 active deployments
staging - packages/docs — a0176154 Deployed Sep 10, 2026 by mintlify[bot]
Preview – openwork-landing — a0176154 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-app — a0176154 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — a0176154 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — a0176154 Deployed Sep 10, 2026 by vercel[bot]
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