fix(logout): drive portal-host prefix from required SMB_NAME env#10
Open
awais786 wants to merge 5 commits into
Open
fix(logout): drive portal-host prefix from required SMB_NAME env#10awais786 wants to merge 5 commits into
awais786 wants to merge 5 commits into
Conversation
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>
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"foss."as the portal-host prefix atapp/stores/AuthStore.ts:357. Silently broke when the deployment moved fromfoss.*tomoneta.*in the askii.ai cutover.SMB_NAMEenv var (no default — crash loudly on misconfig instead of redirecting to the wrong host).@Publicdecorator onserver/env.ts, flowing throughPublicEnvironmentRegister→window.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.ts—PublicEnv.SMB_NAME?fieldapp/stores/AuthStore.ts— readenv.SMB_NAME.trim()at logout.env.sample— document the varTest plan
SMB_NAME=moneta; verify logout lands onmoneta.<domain>SMB_NAME; verify the SPA crashes loudly at logout (not a silent wrong-host redirect)yarn build(no TS errors onenv.SMB_NAMEaccess)🤖 Generated with Claude Code