Skip to content

fix(logout): drive portal-host prefix from required SMB_NAME env#10

Open
awais786 wants to merge 5 commits into
foss-mainfrom
fix/logout-smb-name
Open

fix(logout): drive portal-host prefix from required SMB_NAME env#10
awais786 wants to merge 5 commits into
foss-mainfrom
fix/logout-smb-name

Conversation

@awais786

@awais786 awais786 commented May 1, 2026

Copy link
Copy Markdown

Summary

  • Logout currently hardcodes "foss." as the portal-host prefix at app/stores/AuthStore.ts:357. Silently broke when the deployment moved from foss.* to moneta.* in the askii.ai cutover.
  • Source the prefix from the required SMB_NAME env var (no default — crash loudly on misconfig instead of redirecting to the wrong host).
  • Exposed to the SPA via the @Public decorator on server/env.ts, flowing through PublicEnvironmentRegisterwindow.env.

Why

Hardcoded prefixes silently break domain cutovers. Container env name (SMB_NAME) is uniform across every devstack app behind ForwardAuth — see sso-rules RULES.md §1 Logout.

Files changed

  • server/env.ts@Public SMB_NAME (required, @IsNotEmpty)
  • shared/types.tsPublicEnv.SMB_NAME? field
  • app/stores/AuthStore.ts — read env.SMB_NAME.trim() at logout
  • .env.sample — document the var

Test plan

  • Deploy with SMB_NAME=moneta; verify logout lands on moneta.<domain>
  • Omit SMB_NAME; verify the SPA crashes loudly at logout (not a silent wrong-host redirect)
  • yarn build (no TS errors on env.SMB_NAME access)

🤖 Generated with Claude Code

The logout redirect hardcoded "foss." as the portal-host prefix. That
broke silently the moment the deployment moved from foss.* to moneta.*
in the askii.ai cutover.

Make the prefix env-driven via a required SMB_NAME var (no default
— crash loudly on misconfig instead of redirecting to the wrong host).
SMB_NAME is exposed to the SPA via the @public decorator on env.ts,
flowing through PublicEnvironmentRegister into window.env.

Container env name (SMB_NAME) is uniform across every devstack app
behind ForwardAuth. See sso-rules RULES.md section 1 Logout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
awais786 added 4 commits May 2, 2026 20:31
Drops SMB_NAME entirely. The previous approach required threading the
value through devstack docker-compose env → @public env class → SPA
bundle, with no default; any broken link crashed logout.

Switching to a regex on window.location.hostname removes the env
dependency and works for any `<prefix>-<app>.<domain>` shape:
- foss-docs.local.moneta.dev → foss.local.moneta.dev
- moneta-docs.askii.ai       → moneta.askii.ai
Cleanup follow-up to ec18040 — the regex-based portal-host derivation
no longer reads SMB_NAME, so the .env.sample row and the PublicEnv
TypeScript field are dead. Removed both.
Reverts the SMB_NAME removal from shared/types.ts in the previous
cleanup commit. The field is harmless to keep on the type, even though
the SPA logout path no longer reads it.
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