Skip to content

feat: per-realm web client login, realm chooser & backend-served auth workflow UI - #3104

Merged
tada5hi merged 12 commits into
masterfrom
feat/per-realm-web-client-login
Jun 10, 2026
Merged

tada5hi merged 12 commits into
masterfrom
feat/per-realm-web-client-login

Conversation

@tada5hi

@tada5hi tada5hi commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This branch turns the login entrypoint into a per-realm flow and makes server-core fully self-sufficient for every auth workflow (headless deployments included).

Per-realm web client + realm-selection login

  • Auto-provisions a public OAuth2 client named web for every realm — at startup (incl. pre-existing realms) and on runtime realm creation. Public (is_confidential: false, PKCE required), built_in, scope: global openid, one <origin>/** redirect entry per trusted app origin. No migration — provisioning is idempotent (MERGE, guarded on built_in) and reconciles on every startup.
  • client-web /login is now a Keycloak-style realm chooser (single realm auto-selects; client-side search above 8 realms). Selecting a realm runs authorization-code + PKCE against client_id=web&realm_id=<id>; the global routing interceptor verifies state and exchanges the code.
  • built_in clients auto-consent in the SSR /authorize UI (with fallback to the manual Allow/Deny form if the auto-submit fails). web/system are reserved client names; the validator strips built_in so no API caller can self-assign it.
  • ADDITIONAL_DOMAINS config extends the trusted app origins; this set drives both the web client's redirect allowlist and the CORS origin allowlist.

Backend-served auth workflow UI + status endpoint

  • /register, /activate, /password-forgot, /password-reset now serve SSR pages from the embedded UI (GET), while POST on the same paths stays the JSON API. Pages render a localized "disabled" notice instead of 404 when a workflow is off (stale mail links shouldn't dead-end).
  • New public status endpoint GET / → { version, date, features: { registration, passwordRecovery, emailVerification } } (StatusResponse in core-http-kit, client.status.get()); the same flags ride the SSR hydration payload.
  • New kit form components (ALoginForm, ARegisterForm, AActivateForm, APasswordForgotForm, APasswordResetForm) + shared AAuthShell chrome; client-web auth pages use a dedicated chrome-less auth layout.
  • Workflow links carry a same-origin redirect param so "back to login" restores the original /authorize request; sanitizeRelativeRedirect() rejects absolute / protocol-relative URLs (open-redirect guard).

Mail-template renderer

  • Workflow mails go through a new IMailTemplateRenderer port: localized copy (en/de/fr/es, BCP-47-narrowed), html-escaped interpolation, branded shell, multipart (html + text).
  • When publicUrl is set, mails deep-link to the SSR pages (/activate?token=…, /password-reset?token=…&realm_id=…); the raw code stays in the body for copy/paste, no PII in URLs.

Locale ownership refactor

  • @vuecs/locale is now the source of truth for the UI locale (cookie-backed vc-locale, browser auto-resolve, <html lang> sync); ilingo follows one-way via syncTranslatorLocaleFromManager. The kit's language switcher works with or without vuecs-locale installed.

Fixes & hardening

  • XSS / PKCE / realm / config hardening across the auth workflow flows; redirect + mail-link escaping.
  • Tokens issued via a client keep the user's global roles.
  • Realm grid no longer flashes the untranslated "no results" state during SSR/first paint (skeleton is gated on first load completion).

⚠️ Behavioral change (deploy note)

CORS previously reflected all origins; it is now restricted to publicUrl + additionalDomains. In production, if client-web is served from a different origin than the API's PUBLIC_URL, you must add that origin to ADDITIONAL_DOMAINS or both CORS and the login redirect (<origin>/**) will reject it. In non-production, http://localhost:3000 is seeded automatically.

Security: the web client is built_in + global scope, so any allowlisted origin can obtain a full-permission user token after login — only list origins you control.

Audit notes (non-blocking)

Verified end-to-end: /authorize verifier resolves the per-realm web client via findOneByIdOrName(client_id, realm_id); GET /realms is unauthenticated so the logged-out realm grid loads; <origin>/** matches /login/callback; token-exchange param shapes match. Known minor smells left as-is:

  • ARealmGrid caps at 100 realms (alphabetical; client-side search mitigates, no paging).
  • exchangeAuthorizationCode doesn't emit LOGGED_IN (no current subscribers; latent).
  • Runtime realm-create logs and swallows a web-client provisioning failure (self-heals at next startup) rather than rolling back the realm.

Test plan

  • npm run test --workspace=apps/server-core green
  • Builds pass, eslint clean
  • Manual: click through /login realm selection → consent auto-submit → token exchange → land on home, in both dev and a prod-like split-origin setup
  • Manual: confirm ADDITIONAL_DOMAINS correctly gates CORS + redirect in production
  • Manual: register / activate / password-forgot / password-reset SSR pages, incl. disabled-feature notices and mail deep links

Summary by CodeRabbit

  • New Features

    • Expanded auth UX: multi‑realm login, callback redirect, chrome‑less auth layout, hero graphic, realm picker, full register/activate/password‑forgot/reset flows, and auto‑consent for system clients
    • Improved OAuth2 UX: PKCE-based flow, persisted authorize state, smoother token exchange, and automatic per‑realm public web client provisioning
  • Locale & Theme

    • Cookie-backed locale and color‑mode with language switcher and auth gadgets
  • Security

    • Safer relative-redirect validation and safer email deep‑link handling when public URL set
  • Documentation

    • Updated deployment and provisioning guidance for trusted origins
  • Tests

    • New/updated unit tests covering origins, provisioning, mail templates, redirects, and status features

Auto-provision a public OAuth2 client named `web` for every realm
(public, PKCE, built_in, scope `global openid`) at startup and on
runtime realm creation, and turn client-web `/login` into a realm
chooser that drives the auth-code + PKCE flow against that client.

- core-kit: CLIENT_WEB_NAME / CLIENT_RESERVED_NAMES constants
- server-core: WebClientProvisioner (idempotent, built_in-guarded),
  startup + RealmService runtime hook, reserved-name guard in
  ClientService, ADDITIONAL_DOMAINS config + getAppOrigins, CORS
  origin allowlist derived from trusted app origins
- client-web-kit: PKCE/state + authorization-request helpers,
  buildAuthorizeURL, ARealmGrid, SSR auto-consent for built_in
  clients, exchangeAuthorizationCode accepts code_verifier /
  redirect_uri / client_id / realm_id
- client-web-nuxt: routing interceptor verifies state and replays
  the stored PKCE request at the token exchange
- client-web: /login realm grid + /login/callback
- docs + .agents/architecture.md
Copilot AI review requested due to automatic review settings June 9, 2026 18:47
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Implements per-realm automatic provisioning of a built-in public OAuth2 web client, trusted-origin derivation (additionalDomains), server-served SSR workflow pages (authorize/register/activate/password flows), client PKCE/state helpers and authorization-request persistence, realm-selection login UI, routing callback handling, auto-consent for built-in clients, i18n and UI shell updates, plus tests and docs.

Changes

Per-Realm Web Client Provisioning with Realm Selection Login

Layer / File(s) Summary
Reserved Client Names & Service Guardrails
packages/core-kit/src/domains/client/constants.ts, packages/core-kit/src/domains/client/index.ts, apps/server-core/src/core/entities/client/service.ts, apps/server-core/test/unit/core/entities/client/service.spec.ts
Exports CLIENT_WEB_NAME, CLIENT_SYSTEM_NAME, and CLIENT_RESERVED_NAMES. ClientService.save() now rejects create/update to reserved names unless the target is the matching built-in client.
Configuration Schema & Origin Derivation
apps/server-core/src/app/modules/config/constants.ts, apps/server-core/src/app/modules/config/types.ts, apps/server-core/src/app/modules/config/parse.ts, apps/server-core/src/app/modules/config/read/env.ts, apps/server-core/src/app/modules/config/normalize.ts, apps/server-core/src/app/modules/config/origins.ts, apps/server-core/src/app/modules/config/index.ts, apps/server-core/test/unit/config/index.spec.ts
Introduces additionalDomains config with env parsing, validation, and dev localhost seeding. getAppOrigins() returns a deduplicated list of trusted origins derived from publicUrl and additionalDomains.
Web Client Provisioning Interface & Implementation
apps/server-core/src/core/entities/client/types.ts, apps/server-core/src/core/entities/client/web-client.ts, apps/server-core/src/core/entities/client/index.ts, apps/server-core/test/unit/core/entities/client/web-client.spec.ts
Adds IWebClientProvisioner and WebClientProvisioner; buildWebClientAttributes() builds built-in public web client attributes (non-confidential, PKCE/authorization-code, scopes, wildcard redirect_uri per origin). ensureForRealm() idempotently creates or refreshes the built-in client and skips overwriting non-built-in conflicts.
Server-Side Integration & Wiring
apps/server-core/src/core/entities/realm/service.ts, apps/server-core/src/app/modules/http/modules/controller.ts, apps/server-core/src/app/modules/http/modules/middleware.ts, apps/server-core/src/app/modules/provisioning/module.ts, apps/server-core/src/adapters/http/middleware/built-in/cors.ts, apps/server-core/test/unit/core/entities/realm/service.spec.ts
Wires WebClientProvisioner into RealmService, controller, and provisioning module; provisioner is used at startup to ensure all realms have web client and on realm creation. CORS middleware defaults origin to getAppOrigins(config) when not explicitly set.
Server UI Rendering & Workflow Controllers
apps/server-core/src/adapters/http/ui/render.ts, apps/server-core/src/adapters/http/ui/types.ts, apps/server-core/src/adapters/http/ui/index.ts, apps/server-core/src/adapters/http/controllers/workflows/authorize/module.ts, apps/server-core/src/adapters/http/controllers/workflows/register/module.ts, apps/server-core/src/adapters/http/controllers/workflows/activate/module.ts, apps/server-core/src/adapters/http/controllers/workflows/password-forgot/module.ts, apps/server-core/src/adapters/http/controllers/workflows/password-reset/module.ts, apps/server-core/src/adapters/http/controllers/workflows/status/module.ts
Adds renderUIPage SSR helper and sanitizeRelativeRedirect; updates workflow controllers to serve GET SSR pages (and existing POST APIs), pass UI options (baseURL + features), and return enriched status response including features.
Client-Side OAuth2 Utilities
packages/client-web-kit/src/core/oauth2/pkce.ts, packages/client-web-kit/src/core/oauth2/authorization-request.ts, packages/client-web-kit/src/core/oauth2/index.ts, packages/client-web-kit/src/core/index.ts, packages/client-web-kit/src/core/store/create.ts
Adds PKCE generation (createPKCE(), createState()), sessionStorage-backed save/load/clearAuthorizationRequest, buildAuthorizeURL(), re-exports oauth2, and extends exchangeAuthorizationCode() to accept PKCE and redirect parameters.
Realm Selection UI Component & Login Pages
packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue, packages/client-web-kit/src/components/entities/realm/index.ts, apps/client-web/pages/login/index.vue, apps/client-web/pages/login/callback.vue, apps/client-web/pages/login.vue
New ARealmGrid component and login pages: realm-selection page initiates PKCE/state, persists authorization request, and redirects to /authorize. Callback page shows spinner and navigates home. Previous apps/client-web/pages/login.vue removed.
Authorize Form Auto-Consent & Routing Interceptor
packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue, packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts
AuthorizeForm auto-consents for built-in clients (spinner during auto-authorize). Routing interceptor loads persisted authorization request, validates state, exchanges code with saved PKCE/params, clears the stored request on success/failure, and cleans code/state from the URL.
Auth UI Shell, Cookie/Locale/ColorMode & Header
packages/client-web-kit/src/components/utility/AAuthShell.vue, packages/client-web-kit/src/components/utility/AColorModeSwitcher.vue, packages/client-web-kit/src/components/utility/ALanguageSwitcherDropdown.ts, packages/client-web-kit/src/components/utility/index.ts, apps/client-web/layouts/auth.vue, apps/client-web/components/header.vue, apps/server-core/ui/src/App.vue, apps/server-core/ui/src/cookie.ts, apps/server-core/ui/src/color-mode.ts, apps/server-core/ui/src/app.ts
Adds AAuthShell, color-mode switcher, language dropdown refactor, new auth layout, header wiring changes, cookie helpers, color-mode cookie-backed binding, locale persistence and translator synchronization, and UI gadget wiring.
Workflows: Register/Activate/Password Components & Pages
packages/client-web-kit/src/components/workflows/register/*, packages/client-web-kit/src/components/workflows/password/*, packages/client-web-kit/src/components/workflows/login/*, packages/client-web-kit/src/components/workflows/authorize/*, packages/client-web-kit/src/components/workflows/index.ts, apps/server-core/ui/src/pages/*
Adds client-side forms and pages for register/activate/password-forgot/password-reset, updates authorize/login components to support register/password links and use auth shell, and re-exports workflow components.
i18n Translation Keys & Catalogs
packages/i18n/src/constants.ts, packages/i18n/src/catalogs/* (en,de,es,fr)
Adds new translation keys for login/register/password workflows, moves theme switch keys into common catalog, and updates translations across supported locales.
Mail Templates & Renderer
apps/server-core/src/core/mail/types.ts, apps/server-core/src/core/mail/templates.ts, apps/server-core/src/core/mail/renderer.ts, apps/server-core/src/core/mail/index.ts
Adds mail template names/types, localized template strings, and MailTemplateRenderer that returns escaped branded HTML/text for registration activation and password reset templates.
Tests & Documentation
apps/server-core/test/unit/config/index.spec.ts, apps/server-core/test/unit/core/entities/client/web-client.spec.ts, apps/server-core/test/unit/core/entities/realm/service.spec.ts, apps/server-core/test/unit/http/controllers/workflows/status.spec.ts, apps/server-core/test/unit/adapters/http/request/redirect.spec.ts, apps/server-core/test/unit/core/mail/renderer.spec.ts, .agents/architecture.md, .agents/structure.md, docs/src/guide/deployment/*
Adds unit tests for origin derivation, web-client provisioning, realm provisioning wiring, status endpoint features, redirect sanitization, mail rendering; updates architecture and deployment docs to document additionalDomains, provisioning, and SSR workflow UI pages.
Misc / Packaging
apps/server-core/package.json, packages/client-web-kit/package.json, apps/server-core/src/adapters/http/middleware/built-in/cors.ts, apps/server-core/src/app/modules/http/modules/middleware.ts
Minor dependency reordering/additions and inline CORS documentation; CORS default origin now derives from getAppOrigins(config) when unset.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • authup/authup#3011: Prior AuthorizeController rendering refactor the SSR rendering changes build upon.
  • authup/authup#2836: Related provisioning framework and startup synchronizer used by provisioning logic.
  • authup/authup#3077: Related UI/theme and header dark-mode changes overlapping header/color-mode work.

Poem

🐰 I hopped through realms and hid a key,
PKCE curled safe for each identity.
Built-in web sprouts per trusted shore,
Emails wrapped, links safe as before.
A spinner hums — then home we flee.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/per-realm-web-client-login

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

authup

npm i https://pkg.pr.new/authup@3104

@authup/client-web

npm i https://pkg.pr.new/@authup/client-web@3104

@authup/server-core

npm i https://pkg.pr.new/@authup/server-core@3104

@authup/access

npm i https://pkg.pr.new/@authup/access@3104

@authup/client-web-kit

npm i https://pkg.pr.new/@authup/client-web-kit@3104

@authup/client-web-kit-theme

npm i https://pkg.pr.new/@authup/client-web-kit-theme@3104

@authup/client-web-nuxt

npm i https://pkg.pr.new/@authup/client-web-nuxt@3104

@authup/client-web-theme

npm i https://pkg.pr.new/@authup/client-web-theme@3104

@authup/core-http-kit

npm i https://pkg.pr.new/@authup/core-http-kit@3104

@authup/core-kit

npm i https://pkg.pr.new/@authup/core-kit@3104

@authup/core-realtime-kit

npm i https://pkg.pr.new/@authup/core-realtime-kit@3104

@authup/errors

npm i https://pkg.pr.new/@authup/errors@3104

@authup/i18n

npm i https://pkg.pr.new/@authup/i18n@3104

@authup/kit

npm i https://pkg.pr.new/@authup/kit@3104

@authup/server-adapter-kit

npm i https://pkg.pr.new/@authup/server-adapter-kit@3104

@authup/server-adapter-node

npm i https://pkg.pr.new/@authup/server-adapter-node@3104

@authup/server-adapter-socket-io

npm i https://pkg.pr.new/@authup/server-adapter-socket-io@3104

@authup/server-adapter-web

npm i https://pkg.pr.new/@authup/server-adapter-web@3104

@authup/server-kit

npm i https://pkg.pr.new/@authup/server-kit@3104

@authup/server-test-kit

npm i https://pkg.pr.new/@authup/server-test-kit@3104

@authup/specs

npm i https://pkg.pr.new/@authup/specs@3104

commit: f97215f

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a per-realm, built-in public OAuth2 client (web) and updates the web login flow to a realm-selection + authorization-code-with-PKCE flow, while tightening CORS/redirect origin allowlists based on PUBLIC_URL and ADDITIONAL_DOMAINS.

Changes:

  • Auto-provision a built-in public web client for every realm (startup reconciliation + runtime realm creation hook) and reserve web/system client names from API callers.
  • Switch client-web login to a realm chooser that initiates auth-code + PKCE and persists the authorization request for callback exchange/validation.
  • Restrict CORS origins (and web redirect allowlist origins) to trusted origins derived from publicUrl + additionalDomains.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/core-kit/src/domains/client/index.ts Re-exports client constants to make reserved names available from core-kit.
packages/core-kit/src/domains/client/constants.ts Adds system/web reserved client name constants.
packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts Enhances callback handling: loads stored auth request, validates state, and exchanges code with PKCE parameters.
packages/client-web-kit/src/core/store/create.ts Extends exchangeAuthorizationCode to accept PKCE/client/realm params.
packages/client-web-kit/src/core/oauth2/pkce.ts Adds PKCE + state generation helpers for auth-code flow.
packages/client-web-kit/src/core/oauth2/index.ts Exports new OAuth2 helper modules.
packages/client-web-kit/src/core/oauth2/authorization-request.ts Adds sessionStorage persistence for state/PKCE/redirect replay and authorize URL builder.
packages/client-web-kit/src/core/index.ts Exposes OAuth2 helpers from the package’s core barrel.
packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue Adds auto-consent for built_in clients in the SSR authorize UI.
packages/client-web-kit/src/components/entities/realm/index.ts Exports the new realm grid component.
packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue Adds a simple realm picker grid (unauthenticated realms listing).
docs/src/guide/deployment/provisioning.md Documents per-realm web client behavior and trusted origins concept.
docs/src/guide/deployment/configuration-server-core.md Documents additionalDomains / ADDITIONAL_DOMAINS and its security implications.
docs/src/guide/deployment/configuration-client-web.md Documents production requirements for UI origin allowlisting.
apps/server-core/test/unit/core/entities/realm/service.spec.ts Adds coverage ensuring realm-create triggers web client provisioning when wired.
apps/server-core/test/unit/core/entities/client/web-client.spec.ts Adds unit tests for web client attribute building and idempotent provisioning behavior.
apps/server-core/test/unit/core/entities/client/service.spec.ts Adds tests for reserved-name guardrails and stripping built_in on create.
apps/server-core/test/unit/config/index.spec.ts Adds tests for deriving/deduping trusted app origins from config.
apps/server-core/src/core/entities/realm/service.ts Wires runtime provisioning hook into realm creation via IWebClientProvisioner.
apps/server-core/src/core/entities/client/web-client.ts Implements WebClientProvisioner and buildWebClientAttributes for per-realm web client upsert.
apps/server-core/src/core/entities/client/types.ts Introduces IWebClientProvisioner interface.
apps/server-core/src/core/entities/client/service.ts Adds reserved client-name rejection for API create/update flows.
apps/server-core/src/core/entities/client/index.ts Exports web-client provisioner utilities.
apps/server-core/src/app/modules/provisioning/module.ts Adds startup reconciliation to upsert the web client for every realm.
apps/server-core/src/app/modules/http/modules/middleware.ts Restricts CORS to trusted origins by default (unless explicitly configured).
apps/server-core/src/app/modules/http/modules/controller.ts Injects a web-client provisioner into the realm controller/service wiring.
apps/server-core/src/app/modules/config/types.ts Adds additionalDomains to server-core config type.
apps/server-core/src/app/modules/config/read/env.ts Reads ADDITIONAL_DOMAINS from env into config input.
apps/server-core/src/app/modules/config/parse.ts Validates additionalDomains as URL array.
apps/server-core/src/app/modules/config/origins.ts Adds getAppOrigins() helper to derive/dedupe bare origins.
apps/server-core/src/app/modules/config/normalize.ts Seeds localhost:3000 in non-production and normalizes additionalDomains.
apps/server-core/src/app/modules/config/index.ts Re-exports getAppOrigins().
apps/server-core/src/app/modules/config/constants.ts Adds ADDITIONAL_DOMAINS env var constant.
apps/server-core/src/adapters/http/middleware/built-in/cors.ts Clarifies CORS origin behavior and keeps options merge behavior.
apps/client-web/pages/login/index.vue Replaces login screen with realm chooser that initiates auth-code + PKCE.
apps/client-web/pages/login/callback.vue Adds callback route that relies on routing interceptor exchange + redirects home.
apps/client-web/pages/login.vue Removes the previous login page implementation.
.agents/architecture.md Documents the new per-realm web client and realm-selection login architecture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
packages/client-web-kit/src/core/oauth2/authorization-request.ts (1)

26-28: 💤 Low value

Consider extracting the sessionStorage guard into a helper.

The typeof sessionStorage === 'undefined' check is repeated in three functions. Extracting it to a small helper would improve maintainability and make the intent clearer.

♻️ Proposed refactor
+function isSessionStorageAvailable(): boolean {
+  return typeof sessionStorage !== 'undefined';
+}
+
 export function saveAuthorizationRequest(request: AuthorizationRequest): void {
-  if (typeof sessionStorage === 'undefined') {
+  if (!isSessionStorageAvailable()) {
     return;
   }
   sessionStorage.setItem(STORAGE_KEY, JSON.stringify(request));
 }

 export function loadAuthorizationRequest(): AuthorizationRequest | undefined {
-  if (typeof sessionStorage === 'undefined') {
+  if (!isSessionStorageAvailable()) {
     return undefined;
   }
   // ...
 }

 export function clearAuthorizationRequest(): void {
-  if (typeof sessionStorage === 'undefined') {
+  if (!isSessionStorageAvailable()) {
     return;
   }
   sessionStorage.removeItem(STORAGE_KEY);
 }

Also applies to: 34-36, 51-53

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/client-web-kit/src/core/oauth2/authorization-request.ts` around
lines 26 - 28, Extract the repeated guard into a small helper named
isSessionStorageAvailable(): boolean in authorization-request.ts and replace the
three occurrences of if (typeof sessionStorage === 'undefined') { return; } with
if (!isSessionStorageAvailable()) { return; } (or guard-return as appropriate)
inside the functions that access sessionStorage; implement
isSessionStorageAvailable to safely check typeof sessionStorage !== 'undefined'
and export it (or keep module-private) so intent is clear and maintenance is
simplified.
apps/server-core/src/core/entities/client/web-client.ts (1)

31-45: ⚡ Quick win

Validate that appOrigins is not empty.

The function constructs redirect_uri by mapping over appOrigins. If the array is empty, redirect_uri will be an empty string, which would break OAuth authorization flows. Since buildWebClientAttributes is exported and could be called from other contexts, defensive validation is a best practice.

🛡️ Suggested validation
 export function buildWebClientAttributes(
     realm: Realm | { id: string },
     appOrigins: string[],
 ): Partial<Client> {
+    if (appOrigins.length === 0) {
+        throw new Error('appOrigins cannot be empty when building web client attributes');
+    }
+
     return {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server-core/src/core/entities/client/web-client.ts` around lines 31 -
45, The buildWebClientAttributes function does not validate appOrigins and will
produce an empty redirect_uri if called with an empty array; add a defensive
check at the start of buildWebClientAttributes to verify appOrigins is a
non-empty array and throw a clear error (or return a controlled failure) if it's
empty or not provided so callers cannot create a client with an invalid
redirect_uri; update any tests or callers that assume empty arrays accordingly
and reference buildWebClientAttributes and the redirect_uri construction to
locate the change.
apps/server-core/test/unit/config/index.spec.ts (1)

14-38: ⚡ Quick win

Type casting bypasses type safety in tests.

The test objects use as any type casting (lines 19, 31), which disables TypeScript's type checking and could hide type errors.

Consider using the proper Pick type instead:

♻️ Suggested type-safe alternative
         it('should derive the origin from publicUrl, stripping any path', () => {
             const origins = getAppOrigins({
                 publicUrl: 'https://auth.example.com/sub/path',
                 additionalDomains: [],
-            } as any);
+            } satisfies Pick<Config, 'publicUrl' | 'additionalDomains'>);

             expect(origins).toEqual(['https://auth.example.com']);
         });

         it('should merge publicUrl with additionalDomains and dedupe by origin', () => {
             const origins = getAppOrigins({
                 publicUrl: 'https://auth.example.com',
                 additionalDomains: [
                     'https://auth.example.com/ignored-path',
                     'http://localhost:3000',
                 ],
-            } as any);
+            } satisfies Pick<Config, 'publicUrl' | 'additionalDomains'>);

             expect(origins).toEqual([
                 'https://auth.example.com',
                 'http://localhost:3000',
             ]);
         });

Note: satisfies was introduced in TypeScript 4.9 and provides type checking while preserving the literal type.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server-core/test/unit/config/index.spec.ts` around lines 14 - 38, The
tests currently use unsafe type casts (`as any`) when calling getAppOrigins;
replace those casts with a type-safe fixture such as using Pick or the
`satisfies` operator to match the production config shape expected by
getAppOrigins (e.g., create objects typed as
Pick<AppConfig,'publicUrl'|'additionalDomains'> or use `... satisfies
AppConfig`), update both test cases that construct the config input for
getAppOrigins to use the typed object instead of `as any`, and ensure imports or
type names (AppConfig, getAppOrigins) are referenced correctly so TypeScript
checks the test inputs without losing literal types.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/server-core/src/app/modules/config/normalize.ts`:
- Around line 41-51: The code currently seeds devOrigin
('http://localhost:3000') whenever env !== EnvironmentName.PRODUCTION which also
affects TEST; update the behavior to match intent by either (A) changing the
comment above the block to say "In non-production..." to reflect the current
condition, or (B) narrow the runtime check to env ===
EnvironmentName.DEVELOPMENT if seeding should be development-only; modify the
block that touches parsed.additionalDomains / additionalDomains and the env
check (EnvironmentName) accordingly so the comment and condition are consistent.

In
`@packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue`:
- Around line 104-115: The auto-consent flow calls authorize() from onMounted
when autoConsent (computed from props.client.built_in) is true but currently
swallows failures and leaves the spinner running; add an error state (e.g., a
ref authError or authFailed) and ensure authorize() sets that state and clears
any loading flag in its catch block (where the TODO is), and also call the
existing toast/notification helper or emit an error event there; update the
template conditional rendering to show a fallback error message and the consent
UI (or a retry button) when authError is set so auto-consent failures surface to
the user instead of freezing the spinner.

---

Nitpick comments:
In `@apps/server-core/src/core/entities/client/web-client.ts`:
- Around line 31-45: The buildWebClientAttributes function does not validate
appOrigins and will produce an empty redirect_uri if called with an empty array;
add a defensive check at the start of buildWebClientAttributes to verify
appOrigins is a non-empty array and throw a clear error (or return a controlled
failure) if it's empty or not provided so callers cannot create a client with an
invalid redirect_uri; update any tests or callers that assume empty arrays
accordingly and reference buildWebClientAttributes and the redirect_uri
construction to locate the change.

In `@apps/server-core/test/unit/config/index.spec.ts`:
- Around line 14-38: The tests currently use unsafe type casts (`as any`) when
calling getAppOrigins; replace those casts with a type-safe fixture such as
using Pick or the `satisfies` operator to match the production config shape
expected by getAppOrigins (e.g., create objects typed as
Pick<AppConfig,'publicUrl'|'additionalDomains'> or use `... satisfies
AppConfig`), update both test cases that construct the config input for
getAppOrigins to use the typed object instead of `as any`, and ensure imports or
type names (AppConfig, getAppOrigins) are referenced correctly so TypeScript
checks the test inputs without losing literal types.

In `@packages/client-web-kit/src/core/oauth2/authorization-request.ts`:
- Around line 26-28: Extract the repeated guard into a small helper named
isSessionStorageAvailable(): boolean in authorization-request.ts and replace the
three occurrences of if (typeof sessionStorage === 'undefined') { return; } with
if (!isSessionStorageAvailable()) { return; } (or guard-return as appropriate)
inside the functions that access sessionStorage; implement
isSessionStorageAvailable to safely check typeof sessionStorage !== 'undefined'
and export it (or keep module-private) so intent is clear and maintenance is
simplified.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85d731c7-e4b0-45d9-beae-7341f7461aa9

📥 Commits

Reviewing files that changed from the base of the PR and between 2032647 and 939df08.

📒 Files selected for processing (38)
  • .agents/architecture.md
  • apps/client-web/pages/login.vue
  • apps/client-web/pages/login/callback.vue
  • apps/client-web/pages/login/index.vue
  • apps/server-core/src/adapters/http/middleware/built-in/cors.ts
  • apps/server-core/src/app/modules/config/constants.ts
  • apps/server-core/src/app/modules/config/index.ts
  • apps/server-core/src/app/modules/config/normalize.ts
  • apps/server-core/src/app/modules/config/origins.ts
  • apps/server-core/src/app/modules/config/parse.ts
  • apps/server-core/src/app/modules/config/read/env.ts
  • apps/server-core/src/app/modules/config/types.ts
  • apps/server-core/src/app/modules/http/modules/controller.ts
  • apps/server-core/src/app/modules/http/modules/middleware.ts
  • apps/server-core/src/app/modules/provisioning/module.ts
  • apps/server-core/src/core/entities/client/index.ts
  • apps/server-core/src/core/entities/client/service.ts
  • apps/server-core/src/core/entities/client/types.ts
  • apps/server-core/src/core/entities/client/web-client.ts
  • apps/server-core/src/core/entities/realm/service.ts
  • apps/server-core/test/unit/config/index.spec.ts
  • apps/server-core/test/unit/core/entities/client/service.spec.ts
  • apps/server-core/test/unit/core/entities/client/web-client.spec.ts
  • apps/server-core/test/unit/core/entities/realm/service.spec.ts
  • docs/src/guide/deployment/configuration-client-web.md
  • docs/src/guide/deployment/configuration-server-core.md
  • docs/src/guide/deployment/provisioning.md
  • packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue
  • packages/client-web-kit/src/components/entities/realm/index.ts
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue
  • packages/client-web-kit/src/core/index.ts
  • packages/client-web-kit/src/core/oauth2/authorization-request.ts
  • packages/client-web-kit/src/core/oauth2/index.ts
  • packages/client-web-kit/src/core/oauth2/pkce.ts
  • packages/client-web-kit/src/core/store/create.ts
  • packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts
  • packages/core-kit/src/domains/client/constants.ts
  • packages/core-kit/src/domains/client/index.ts
💤 Files with no reviewable changes (1)
  • apps/client-web/pages/login.vue

- log+swallow web client provisioning failures on realm create so realm
  creation stays atomic from the caller's perspective
- parse routing-interceptor redirect target via URL so query/hash survive
  and any host is discarded (no open redirect); strip code/state on the
  failure path to prevent a consumed-code reload loop
- fall back from the auto-consent spinner to the manual consent UI when
  confirm() fails, giving the user a retry path
- clarify dev-origin seeding comment to cover test env

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/server-core/src/core/entities/realm/service.ts`:
- Around line 147-163: Add a unit test for RealmService.create that simulates
webClientProvisioner.ensureForRealm throwing so we verify create still resolves
and the realm is persisted: in the existing realm service spec, stub/mocking the
service instance's webClientProvisioner.ensureForRealm to reject/throw, call
RealmService.create(...) and assert the promise resolves (does not reject),
assert the provisioner.ensureForRealm was invoked for the created entity, and
assert the realm was saved (e.g., query the repository or check the returned
entity has an id/persisted marker). Ensure the test cleans up mocks and does not
rely on the success path of ensureForRealm.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5197355-6ada-4264-a269-f4c26aab0ff0

📥 Commits

Reviewing files that changed from the base of the PR and between 939df08 and c966e71.

📒 Files selected for processing (4)
  • apps/server-core/src/app/modules/config/normalize.ts
  • apps/server-core/src/core/entities/realm/service.ts
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue
  • packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/server-core/src/app/modules/config/normalize.ts
  • packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue

tada5hi added 2 commits June 9, 2026 23:50
Redesign ARealmGrid as a modern realm picker (search-on-threshold,
single-realm auto-select, gradient avatars, animated hover border,
skeleton loading) and wrap the login page in an aurora-backed hero
with localized title/subtitle. Adds SEARCH/NO_RESULTS common keys and
LOGIN_TITLE/LOGIN_SUBTITLE app keys across en/de/fr/es.
Complete the realm-selection login arc: the backend-served /authorize
page becomes the hub for password login, IdP login, registration and
password recovery - fully functional in headless deployments.

- status: GET / exposes feature flags (registration, passwordRecovery,
  emailVerification); typed StatusResponse + client.status.get()
- client-web-kit: new workflow forms ARegisterForm (embeds
  AActivateForm on email verification), APasswordForgotForm,
  APasswordResetForm; ALogin renamed to ALoginForm (deprecated alias
  kept) with VCLink-based register/password-forgot links; AAuthShell
  aurora card replaces the legacy hardcoded consent styling;
  AColorModeSwitcher added; LanguageSwitcherDropdown renamed to
  ALanguageSwitcherDropdown (deprecated alias kept)
- server-core: GET /register, /activate, /password-forgot and
  /password-reset serve SSR pages via a shared renderUIPage helper;
  same-origin redirect continuity with open-redirect guard;
  activation/reset mails carry deep links (publicUrl); embedded UI
  gains color-mode + language gadgets with vc-* cookie persistence
  (@vuecs/locale) and self-hosted Nunito/Asap webfonts
- client-web: chrome-less auth layout for login/callback, refined
  realm-grid tiles (no avatars, slug subtitle), orbit-mark hero SVG,
  "Sign in" copy across locales
- i18n: workflow vocabulary authored in en/de/fr/es; SWITCH_TO_* keys
  moved from the app-only APP namespace to COMMON
- fix: ALanguageSwitcherDropdown async setup prevented hydration
  outside a Suspense boundary (dropdown dead on backend pages); IdP
  boxes overflowing the auth card now wrap

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/client-web/layouts/auth.vue`:
- Line 48: The layout currently renders the page directly via <NuxtPage /> which
causes nested page lifecycle issues; replace the <NuxtPage /> usage in
apps/client-web/layouts/auth.vue with the layout slot (<slot />) so Nuxt injects
routed page content into the layout; locate the occurrence of <NuxtPage /> in
the auth.vue template and swap it for a plain <slot /> (preserving any
surrounding container/attributes) to restore correct layout/page composition.

In `@apps/server-core/src/adapters/http/ui/render.ts`:
- Around line 89-98: sanitizeRelativeRedirect currently only checks raw string
prefixes and can be bypassed by percent-encoded separators or control chars;
update sanitizeRelativeRedirect to first safely normalize/decode the input
(e.g., attempt a single decodeURIComponent with try/catch) and then reject any
inputs that contain encoded or decoded separator/control patterns
(percent-encodings for '/' and '\' like %2f/%5c in any case, sequences that
normalize to '//' or '/\' or that do not start with a single '/' after decoding,
and control chars like CR/LF or their encodings such as %0a/%0d). Ensure you
still return undefined for non-strings or empty strings and return the original
input only when the decoded/validated value is a simple relative path beginning
with exactly one '/' and contains no disallowed characters or encoded
separators.

In `@apps/server-core/ui/src/cookie.ts`:
- Around line 16-17: The cookie lookup builds a RegExp from the raw cookie name
which allows regex metacharacters in name to break or throw; escape the cookie
name before interpolation. Add or use an escapeRegExp helper (e.g.,
escapeRegExp) and call it on the name variable, then construct the RegExp with
the escaped value in the document.cookie.match(...) expression (the line that
currently uses new RegExp(`(?:^|;\\s*)${name}=([^;]+)`)). Ensure the helper
replaces all regex-special characters with escaped versions so cookie keys with
symbols are safely matched.

In `@apps/server-core/ui/src/pages/activate.vue`:
- Around line 44-45: The activation form is gated only by
data.features.registration which can display a dead-end when activation tokens
are only issued if email verification is enabled; update the visibility check
for the component that receives :token="data.token" to require both registration
and the email-verification feature (e.g., check data.features.registration &&
(data.features.emailVerification || data.features.email_verification)), so the
activation form is only shown when tokens will actually be issued.
- Around line 54-59: The anchor binds untrusted data.redirect directly to href,
allowing unsafe schemes (e.g., javascript:) or off-origin navigation; update the
rendering to validate and sanitize data.redirect before binding: implement a
check in the component (e.g., a computed property or method used by the
template) that rejects or normalizes values that are not a safe relative path
(e.g., starts with '/' and does not start with '//' or contain newlines) or that
are not on an explicit allowlist of origins/paths, and only return the sanitized
value for use in the template (leave translations.backToLogin untouched); if
validation fails, render a safe default (such as '/login' or no anchor) instead
of the raw data.redirect.

In `@packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue`:
- Around line 78-81: The current auto-select logic (props.autoSelectSingle)
immediately sets redirecting.value = true and emits('select', items.value[0])
with no recovery if navigation fails; modify the ARealmGrid component to add a
fallback path: start a timeout when auto-select triggers that will reset
redirecting.value and emit an 'error' or 'autoSelectTimeout' event if no
confirmation/clear happens in e.g. 5–10s, and ensure the component clears that
timeout when a successful navigation/confirmation path is detected or when the
parent calls a new reset method/prop; reference the existing symbols
redirecting.value, props.autoSelectSingle, items.value and emit('select', ...)
to locate where to add the timer, cancellation logic, and the new emit('error'
or 'autoSelectTimeout') so parents can handle failures and reset UI.

In
`@packages/client-web-kit/src/components/workflows/password/PasswordResetForm.vue`:
- Around line 60-64: The reactive form object copies props.token once, causing
stale tokens when the parent updates props.token; add a watcher to keep
form.token in sync with prop changes (watch(() => props.token, v => form.token =
v)) and ensure vue's watch is imported; update PasswordResetForm.vue to set
form.token initially as now but also update it inside the watch so submissions
always use the current props.token.

In `@packages/client-web-kit/src/components/workflows/register/ActivateForm.vue`:
- Line 53: The reactive form object is initialized with props.token but not
updated when the token prop changes, so add a watcher to keep form.token in sync
with the prop; locate the reactive form declaration (const form = reactive({
token: props.token })) in ActivateForm.vue and add a watch on props.token (or a
watchEffect) that assigns the new prop value to form.token whenever props.token
changes so the component won't submit a stale token.

In `@packages/client-web-kit/src/components/workflows/register/RegisterForm.vue`:
- Around line 166-168: RegisterForm currently listens to ActivateForm and
re-emits only the 'done' event, dropping 'failed' so activation errors don't
propagate; update the RegisterForm component where ActivateForm is used (the
<ActivateForm ... /> block) to forward its 'failed' event as well by adding an
`@failed` handler that re-emits 'failed' (i.e., `@failed`="$emit('failed', $event)")
alongside the existing `@done` emission so parent listeners on RegisterForm
receive activation failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 67bcdfac-4dd9-48d8-8253-bff1607cb7bc

📥 Commits

Reviewing files that changed from the base of the PR and between c966e71 and 90b9405.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (76)
  • .agents/architecture.md
  • .agents/structure.md
  • apps/client-web/components/header.vue
  • apps/client-web/components/svg/LoginHeroSVG.vue
  • apps/client-web/layouts/auth.vue
  • apps/client-web/pages/login/callback.vue
  • apps/client-web/pages/login/index.vue
  • apps/server-core/package.json
  • apps/server-core/src/adapters/http/controllers/workflows/activate/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/authorize/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/authorize/types.ts
  • apps/server-core/src/adapters/http/controllers/workflows/password-forgot/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/password-reset/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/register/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/status/module.ts
  • apps/server-core/src/adapters/http/ui/index.ts
  • apps/server-core/src/adapters/http/ui/render.ts
  • apps/server-core/src/adapters/http/ui/types.ts
  • apps/server-core/src/app/modules/http/modules/controller.ts
  • apps/server-core/src/core/identity/password-recovery/service.ts
  • apps/server-core/src/core/identity/password-recovery/types.ts
  • apps/server-core/src/core/identity/registration/service.ts
  • apps/server-core/src/core/identity/registration/types.ts
  • apps/server-core/test/unit/http/controllers/workflows/status.spec.ts
  • apps/server-core/ui/src/App.vue
  • apps/server-core/ui/src/app.ts
  • apps/server-core/ui/src/color-mode.ts
  • apps/server-core/ui/src/cookie.ts
  • apps/server-core/ui/src/pages/activate.vue
  • apps/server-core/ui/src/pages/authorize.vue
  • apps/server-core/ui/src/pages/password-forgot.vue
  • apps/server-core/ui/src/pages/password-reset.vue
  • apps/server-core/ui/src/pages/register.vue
  • apps/server-core/ui/src/tailwind.css
  • packages/client-web-kit/package.json
  • packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue
  • packages/client-web-kit/src/components/utility/AAuthShell.vue
  • packages/client-web-kit/src/components/utility/AColorModeSwitcher.vue
  • packages/client-web-kit/src/components/utility/ALanguageSwitcherDropdown.ts
  • packages/client-web-kit/src/components/utility/index.ts
  • packages/client-web-kit/src/components/workflows/authorize/Authorize.vue
  • packages/client-web-kit/src/components/workflows/index.ts
  • packages/client-web-kit/src/components/workflows/login/LoginForm.vue
  • packages/client-web-kit/src/components/workflows/login/index.ts
  • packages/client-web-kit/src/components/workflows/password/PasswordForgotForm.vue
  • packages/client-web-kit/src/components/workflows/password/PasswordResetForm.vue
  • packages/client-web-kit/src/components/workflows/password/index.ts
  • packages/client-web-kit/src/components/workflows/register/ActivateForm.vue
  • packages/client-web-kit/src/components/workflows/register/RegisterForm.vue
  • packages/client-web-kit/src/components/workflows/register/index.ts
  • packages/core-http-kit/src/client/module.ts
  • packages/core-http-kit/src/domains/workflows/index.ts
  • packages/core-http-kit/src/domains/workflows/status/index.ts
  • packages/core-http-kit/src/domains/workflows/status/module.ts
  • packages/core-http-kit/src/domains/workflows/status/types.ts
  • packages/i18n/src/catalogs/de/action.ts
  • packages/i18n/src/catalogs/de/app.ts
  • packages/i18n/src/catalogs/de/client.ts
  • packages/i18n/src/catalogs/de/common.ts
  • packages/i18n/src/catalogs/de/field.ts
  • packages/i18n/src/catalogs/en/action.ts
  • packages/i18n/src/catalogs/en/app.ts
  • packages/i18n/src/catalogs/en/client.ts
  • packages/i18n/src/catalogs/en/common.ts
  • packages/i18n/src/catalogs/en/field.ts
  • packages/i18n/src/catalogs/es/action.ts
  • packages/i18n/src/catalogs/es/app.ts
  • packages/i18n/src/catalogs/es/client.ts
  • packages/i18n/src/catalogs/es/common.ts
  • packages/i18n/src/catalogs/es/field.ts
  • packages/i18n/src/catalogs/fr/action.ts
  • packages/i18n/src/catalogs/fr/app.ts
  • packages/i18n/src/catalogs/fr/client.ts
  • packages/i18n/src/catalogs/fr/common.ts
  • packages/i18n/src/catalogs/fr/field.ts
  • packages/i18n/src/constants.ts
✅ Files skipped from review due to trivial changes (19)
  • packages/client-web-kit/src/components/utility/AColorModeSwitcher.vue
  • packages/i18n/src/catalogs/es/field.ts
  • .agents/structure.md
  • packages/core-http-kit/src/domains/workflows/status/types.ts
  • packages/core-http-kit/src/domains/workflows/status/index.ts
  • apps/server-core/src/core/identity/password-recovery/types.ts
  • packages/i18n/src/catalogs/en/common.ts
  • apps/server-core/src/adapters/http/ui/types.ts
  • packages/client-web-kit/src/components/workflows/password/index.ts
  • packages/i18n/src/catalogs/en/client.ts
  • packages/core-http-kit/src/domains/workflows/index.ts
  • apps/server-core/ui/src/tailwind.css
  • apps/server-core/ui/src/color-mode.ts
  • packages/client-web-kit/src/components/workflows/login/index.ts
  • apps/server-core/src/core/identity/registration/types.ts
  • packages/i18n/src/catalogs/fr/field.ts
  • packages/client-web-kit/src/components/workflows/register/index.ts
  • packages/i18n/src/catalogs/en/field.ts
  • packages/client-web-kit/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/client-web/pages/login/callback.vue
  • apps/client-web/pages/login/index.vue

<ALanguageSwitcherDropdown link-class-extra="auth-layout-gadget" />
</div>

<NuxtPage />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

In Nuxt 4 layouts, is the supported way to render page content instead of, and what are the behavioral differences?

💡 Result:

In Nuxt 4, the <slot /> component is the correct and supported way to render page content within a layout file [1][2]. The <NuxtPage /> component serves a different purpose and is not a replacement for <slot /> inside layouts [3][4]. The behavioral differences and intended usage are as follows: 1. Layout Files (Use <slot />): Layouts are designed as wrappers for your pages [5]. Within a layout file (e.g., app/layouts/default.vue), you use <slot /> to define where the page content should be injected [1][2]. This follows standard Vue slot patterns, allowing you to create flexible layouts with multiple slots (e.g., named slots for headers or sidebars) [1][6]. 2. Application Entry (Use <NuxtPage />): The <NuxtPage /> component is used at the top level of your application (typically in app.vue) to render the actual pages found in the app/pages/ directory [3][5]. It acts as a placeholder that Nuxt automatically populates based on the current route [3]. Summary of roles: - Use in app.vue (or your root component) to render the active page [3][5]. - Use in layout files to define the insertion point for the page content passed through the layout [1][2]. If you were to mistakenly use inside a layout file, it would not function as the slot for that layout's content; rather, it would attempt to render a secondary, nested page view, which is likely not the desired behavior for standard page-layout composition [4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
ls -la
sed -n '1,120p' apps/client-web/layouts/auth.vue | nl -ba | sed -n '35,80p'

Repository: authup/authup

Length of output: 2824


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Show the relevant portion around the referenced line in apps/client-web/layouts/auth.vue
if [ ! -f apps/client-web/layouts/auth.vue ]; then
  echo "Missing file: apps/client-web/layouts/auth.vue"
  exit 1
fi
sed -n '1,140p' apps/client-web/layouts/auth.vue | nl -ba | sed -n '35,90p'

Repository: authup/authup

Length of output: 100


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,160p' apps/client-web/layouts/auth.vue | nl -ba | sed -n '35,95p'

Repository: authup/authup

Length of output: 100


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,180p' apps/client-web/layouts/auth.vue | nl -ba | sed -n '35,105p'

Repository: authup/authup

Length of output: 100


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="apps/client-web/layouts/auth.vue"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE"
  exit 1
fi

# Print lines around the referenced line (48)
start=35
end=70
echo "---- $FILE lines $start-$end ----"
sed -n "${start},${end}p" "$FILE" | cat -n
echo "---- end ----"

Repository: authup/authup

Length of output: 1229


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="apps/client-web/layouts/auth.vue"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE"
  exit 1
fi

start=35
end=70
echo "---- $FILE lines $start-$end ----"
sed -n "${start},${end}p" "$FILE" | cat -n
echo "---- end ----"

Repository: authup/authup

Length of output: 1229


Use layout slot content (<slot />) instead of <NuxtPage /> in apps/client-web/layouts/auth.vue.

This layout is expected to render the current page via <slot />; placing <NuxtPage /> inside the layout can lead to incorrect/nested page lifecycle behavior instead of Nuxt injecting the routed page content into the layout.

Suggested fix
-            <NuxtPage />
+            <slot />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<NuxtPage />
<slot />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/client-web/layouts/auth.vue` at line 48, The layout currently renders
the page directly via <NuxtPage /> which causes nested page lifecycle issues;
replace the <NuxtPage /> usage in apps/client-web/layouts/auth.vue with the
layout slot (<slot />) so Nuxt injects routed page content into the layout;
locate the occurrence of <NuxtPage /> in the auth.vue template and swap it for a
plain <slot /> (preserving any surrounding container/attributes) to restore
correct layout/page composition.

Comment thread apps/server-core/ui/src/cookie.ts Resolved
Comment on lines +54 to +59
<div
v-if="data.redirect"
class="text-center"
>
<a :href="data.redirect">{{ translations.backToLogin }}</a>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Sanitize data.redirect before binding it to href.

Rendering unvalidated redirect strings as anchors can expose unsafe schemes (for example javascript:) or unintended off-origin navigation. Restrict this to a safe relative path or strict allowlist before rendering.

Suggested patch
 <script lang="ts">
 import { AActivateForm, AAuthShell, useTranslations } from '`@authup/client-web-kit`';
 import type { StatusResponseFeatures } from '`@authup/core-http-kit`';
 import { TranslatorTranslationClientKey, TranslatorTranslationNamespace } from '`@authup/i18n`';
-import { defineComponent } from 'vue';
+import { computed, defineComponent } from 'vue';
 import { injectPayload } from '../di';

 export default defineComponent({
     components: { AActivateForm, AAuthShell },
     setup() {
@@
+        const safeRedirect = computed(() => {
+            const value = payload.data?.redirect;
+            if (!value) {
+                return undefined;
+            }
+
+            // Allow only same-origin relative paths.
+            if (value.startsWith('/') && !value.startsWith('//')) {
+                return value;
+            }
+
+            return undefined;
+        });
+
         return {
             data: payload.data,
+            safeRedirect,
             translations,
         };
     },
 });
 </script>
@@
-        <div
-            v-if="data.redirect"
+        <div
+            v-if="safeRedirect"
             class="text-center"
         >
-            <a :href="data.redirect">{{ translations.backToLogin }}</a>
+            <a :href="safeRedirect">{{ translations.backToLogin }}</a>
         </div>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server-core/ui/src/pages/activate.vue` around lines 54 - 59, The anchor
binds untrusted data.redirect directly to href, allowing unsafe schemes (e.g.,
javascript:) or off-origin navigation; update the rendering to validate and
sanitize data.redirect before binding: implement a check in the component (e.g.,
a computed property or method used by the template) that rejects or normalizes
values that are not a safe relative path (e.g., starts with '/' and does not
start with '//' or contain newlines) or that are not on an explicit allowlist of
origins/paths, and only return the sanitized value for use in the template
(leave translations.backToLogin untouched); if validation fails, render a safe
default (such as '/login' or no anchor) instead of the raw data.redirect.

@tada5hi

tada5hi commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

tada5hi added 6 commits June 10, 2026 12:30
Address correctness issues found in review of the auth workflow branch:

- ui: escape the SSR hydration payload (</script>, U+2028/2029) before
  inlining into <script> — workflow pages reflect raw token/realm_id
  query params, so this was a reflected-XSS vector
- oauth2: consent confirm forwards the full code request (code_challenge,
  code_challenge_method, nonce, realm_id) so POST /authorize no longer
  rejects public clients with invalid_request
- oauth2: skip the authorization-code exchange during SSR and render
  /login/callback client-only; running it server-side exchanged without
  the PKCE verifier and burned the single-use code for the public client
- password-recovery: reset deep link carries realm_id, so non-master
  realm users can complete the reset
- config: copy parsed.additionalDomains instead of mutating it in place
- login: preserve sibling query params across the login round-trip
Review-comment fixes and plan-024 §2 duplication collapse in the auth
workflow components:

- RegisterForm forwards ActivateForm `failed` events (were dropped)
- ActivateForm/PasswordResetForm sync form.token when the prop changes
- ARealmGrid exposes reset() so the login page can recover the auto-select
  skeleton when the redirect glue fails
- forms route submit through the existing wrapFnWithBusyState helper
  instead of hand-rolled busy guards
- pkce reuses @authup/kit base64URLEncode (strFromBytes is the only local
  step)
- shared AAuthBackLink + AAuthGadgets kit components replace the back-link
  and color-mode/language cluster duplicated across the forms and both
  auth surfaces (client-web layout + embedded SSR app)
Plan-024 §3/§4 and remaining review comments for the backend auth pages:

- move sanitizeRelativeRedirect to adapters/http/request/helpers and
  harden it against control chars, backslash and percent-encoded
  separator bypasses; add a spec table (the SSR pages are otherwise
  untestable)
- single serveWorkflowPage() helper backs the four workflow GET routes;
  controllers shrink to thin POST adapters
- StatusController reads package.json version once and consumes the
  unified StatusResponseFeatures shape (one feature-flags object)
- renderUIPage caches the immutable dist shell/manifest/render across
  requests and injects the <html> attrs by pattern, not exact string
- WebClientProvisioner dirty-checks before the merge save (no redundant
  UPDATE per realm on steady-state boot)
- locale watchers are client-only (no-op on the SSR render path);
  toAuthupLocale promoted to @authup/i18n matchLocale()
- activate page gates on emailVerification (activation tokens only exist
  then); escape the cookie name regex; realm create test for the
  swallowed provisioner failure
IdentityRoleProvider.reduceByIdentityClient dropped every client-agnostic
role (client_id null) when the token's identity carried a client_id,
keeping only roles scoped to that exact client. The legacy client-web
login used the password grant with no client, so the filter was a no-op
and global/realm roles flowed through. The realm-selection login issues
the token via the per-realm `web` client, which supplies a client_id —
so the filter stripped every global/realm role, leaving introspection's
permissions / realm_access.roles / global_access.roles empty for admin.

Keep null-client (global/realm) roles in addition to roles scoped to the
authenticating client.
Make locale handling consistent with color-mode/palette: @vuecs/locale is
the source of truth (vc-locale cookie, auto-resolution, Config['locale']),
the same way @vuecs/design's bindColorMode owns vc-color-mode.

- ALanguageSwitcherDropdown writes vuecs via a new useLocaleControl()
  helper that prefers @vuecs/locale's useLocaleManager and falls back to
  the ilingo ref when vuecs-locale isn't installed (kit stays usable
  without it)
- syncTranslatorLocaleFromManager() bridges vuecs resolved -> ilingo
  one-way; the previous two-way ilingo<->vuecs bridge is removed
- client-web: drop the config.locale ilingo feed (the @vuecs/nuxt locale
  plugin, on by default, owns Config['locale']); new post plugin runs the
  one-way sync after it. client-web now persists locale like it already
  persists color-mode
- server-core/ui: keep installLocale; replace the two-way bridge with the
  one-way sync
- add @vuecs/locale to client-web-kit deps/peer
Replace the inline mail HTML in RegistrationService / PasswordRecoveryService
with an IMailTemplateRenderer port (core/mail). Services pass
{ template, params: { code, url? }, locale? }; the default MailTemplateRenderer
resolves localized copy (en/de/fr/es, BCP-47-narrowed with default fallback),
html-escapes interpolated values, and wraps the body in a small branded shell
(subject + html + text).

- decouples mail copy/markup from the workflow services
- localized + brandable in one place
- pure + injected, so mail content is now assertable via FakeMailClient
  (adds core/mail/renderer.spec.ts)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (2)
apps/client-web/layouts/auth.vue (1)

42-42: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Use <slot /> instead of <NuxtPage /> in layout files.

This layout must render page content via <slot /> to follow Nuxt's layout contract. <NuxtPage /> is for the root app.vue component, not layouts; using it here causes nested page lifecycle behavior instead of properly injecting the routed page content into the layout wrapper.

🔧 Proposed fix
-            <NuxtPage />
+            <slot />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/client-web/layouts/auth.vue` at line 42, The layout currently renders
routed content with the NuxtPage component (NuxtPage) which is incorrect for
layout files; change the layout template to render the routed page via the
default slot by replacing the NuxtPage usage with a <slot /> so the routed page
is injected correctly into the layout wrapper and lifecycle behavior is
preserved.
apps/server-core/ui/src/pages/activate.vue (1)

58-63: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Sanitize data.redirect before binding to href.

The redirect value originates from query parameters (per the window.ts payload comment) and is rendered directly as an anchor href without client-side validation. This exposes the application to XSS via unsafe URL schemes (e.g., javascript:, data:) or unintended off-origin navigation.

Even if the backend's serveWorkflowPage sanitizes the redirect, defense-in-depth requires client-side validation here. Restrict the rendered value to safe relative paths (starting with / but not //) or an explicit origin allowlist.

🛡️ Proposed sanitization
 <script lang="ts">
 import { AActivateForm, AAuthShell, useTranslations } from '`@authup/client-web-kit`';
 import type { StatusResponseFeatures } from '`@authup/core-http-kit`';
 import { TranslatorTranslationClientKey, TranslatorTranslationNamespace } from '`@authup/i18n`';
-import { defineComponent } from 'vue';
+import { computed, defineComponent } from 'vue';
 import { injectPayload } from '../di';

 export default defineComponent({
     components: { AActivateForm, AAuthShell },
     setup() {
         const payload = injectPayload<{
             features?: StatusResponseFeatures,
             token?: string,
             redirect?: string,
         }>();

         const translations = useTranslations([
             {
                 namespace: TranslatorTranslationNamespace.CLIENT,
                 key: TranslatorTranslationClientKey.WORKFLOW_DISABLED,
             },
             {
                 namespace: TranslatorTranslationNamespace.CLIENT,
                 key: TranslatorTranslationClientKey.BACK_TO_LOGIN,
             },
         ]);

+        const safeRedirect = computed(() => {
+            const value = payload.data?.redirect;
+            if (!value) {
+                return undefined;
+            }
+            // Allow only same-origin relative paths
+            if (value.startsWith('/') && !value.startsWith('//')) {
+                return value;
+            }
+            return undefined;
+        });
+
         return {
             data: payload.data,
+            safeRedirect,
             translations,
         };
     },
 });
 </script>
 <template>
     <AAuthShell>
         <AActivateForm
             v-if="data.features && data.features.emailVerification"
             :token="data.token"
         />
         <div
             v-else
             class="alert alert-warning"
         >
             {{ translations.workflowDisabled }}
         </div>

         <div
-            v-if="data.redirect"
+            v-if="safeRedirect"
             class="text-center"
         >
-            <a :href="data.redirect">{{ translations.backToLogin }}</a>
+            <a :href="safeRedirect">{{ translations.backToLogin }}</a>
         </div>
     </AAuthShell>
 </template>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server-core/ui/src/pages/activate.vue` around lines 58 - 63,
data.redirect is rendered directly into the anchor href in activate.vue, which
can allow unsafe URL schemes; update the template logic (the binding around
data.redirect) to validate and sanitize the redirect before binding: allow only
safe relative paths that start with "/" but not "//", or match a configured
origin allowlist (use window origin comparison), and fall back to a safe
internal path (e.g., "/login") when validation fails; implement the validation
in the component script (adjacent to where data is consumed from the window
payload) and use the sanitized value in the template instead of data.redirect.
🧹 Nitpick comments (1)
apps/server-core/src/adapters/http/ui/render.ts (1)

87-90: ⚖️ Poor tradeoff

Regex-based tag replacement discards existing attributes.

The regex replacement at line 90 completely replaces the <html> tag, which means any attributes present in the source template (or added by Vite's transformIndexHtml in JIT mode) will be lost. While this may be intentional for the current use case, consider preserving or merging existing attributes if the template is expected to carry additional data attributes or other metadata.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server-core/src/adapters/http/ui/render.ts` around lines 87 - 90, The
current regex replacement on variable body (body.replace(/<html\b[^>]*>/i,
`<html ${htmlAttrs}>`)) discards any existing <html> attributes; change it to
capture the existing attribute string (e.g. using /<html\b([^>]*)>/i), parse or
split that captured attrs and merge them with htmlAttrs (preserving existing
keys and avoiding duplicates), then replace the tag using a replacer callback so
the final <html ...> contains both original attributes and the new htmlAttrs;
update the code around body and htmlAttrs (the replace call) to perform this
merge rather than overwriting.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/server-core/src/adapters/http/request/helpers/redirect.ts`:
- Around line 25-28: The current check only tests the raw input for control
characters (using the regex against input) but misses percent-encoded controls
that decode into CR/LF; update the validation in the redirect helper so that
after decoding (using the same decode logic already in use for value) you also
run the control-character test on the decoded string (and handle decode errors
safely), returning undefined if the decoded value contains any control chars
(same /[\u0000-\u0020\u007f]/ check) to prevent header injection; reference the
existing variables input and value (the decoded value) in your change and ensure
you catch/deal with URI-decode errors.

In `@apps/server-core/src/core/mail/renderer.ts`:
- Around line 28-48: In renderHtmlShell, action.url is interpolated directly
into the href which can lead to XSS if the URL contains quotes or HTML-special
chars; fix by escaping the URL for HTML attribute context before injecting it
(e.g. call the same escapeHtml or a dedicated escapeAttribute function on
action.url) and use that escaped value in the href, keeping the existing
escapeHtml(action.label) for the link text.

In `@apps/server-core/test/unit/core/mail/renderer.spec.ts`:
- Around line 14-25: Add a unit test for renderer.render using
MailTemplateName.REGISTRATION_ACTIVATION that passes a malicious URL (e.g.
containing & and a quote plus onclick payload) as the url param and asserts the
produced mail.html does NOT contain the raw onclick payload and DOES contain
escaped entities (e.g. &quot; and/or &amp;) to verify url escaping; place the
test alongside the existing activation tests that already validate code escaping
so it exercises the renderer.render behavior referenced in renderer.ts.

In `@packages/client-web-kit/src/components/utility/AAuthBackLink.vue`:
- Around line 7-14: The template uses VCIcon but it is not imported or
registered; import VCIcon (the component used in the template) alongside VCLink
in the script and add it to the components option inside the defineComponent
call (e.g., components: { VCLink, VCIcon }) so VCIcon is available at runtime
when rendering AAuthBackLink.vue.

---

Duplicate comments:
In `@apps/client-web/layouts/auth.vue`:
- Line 42: The layout currently renders routed content with the NuxtPage
component (NuxtPage) which is incorrect for layout files; change the layout
template to render the routed page via the default slot by replacing the
NuxtPage usage with a <slot /> so the routed page is injected correctly into the
layout wrapper and lifecycle behavior is preserved.

In `@apps/server-core/ui/src/pages/activate.vue`:
- Around line 58-63: data.redirect is rendered directly into the anchor href in
activate.vue, which can allow unsafe URL schemes; update the template logic (the
binding around data.redirect) to validate and sanitize the redirect before
binding: allow only safe relative paths that start with "/" but not "//", or
match a configured origin allowlist (use window origin comparison), and fall
back to a safe internal path (e.g., "/login") when validation fails; implement
the validation in the component script (adjacent to where data is consumed from
the window payload) and use the sanitized value in the template instead of
data.redirect.

---

Nitpick comments:
In `@apps/server-core/src/adapters/http/ui/render.ts`:
- Around line 87-90: The current regex replacement on variable body
(body.replace(/<html\b[^>]*>/i, `<html ${htmlAttrs}>`)) discards any existing
<html> attributes; change it to capture the existing attribute string (e.g.
using /<html\b([^>]*)>/i), parse or split that captured attrs and merge them
with htmlAttrs (preserving existing keys and avoiding duplicates), then replace
the tag using a replacer callback so the final <html ...> contains both original
attributes and the new htmlAttrs; update the code around body and htmlAttrs (the
replace call) to perform this merge rather than overwriting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3b0a4caa-30b9-4b6b-ac4c-d5dbc1f9b449

📥 Commits

Reviewing files that changed from the base of the PR and between 90b9405 and 78b82c0.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (56)
  • .agents/architecture.md
  • .agents/structure.md
  • apps/client-web/layouts/auth.vue
  • apps/client-web/nuxt.config.ts
  • apps/client-web/pages/login/index.vue
  • apps/client-web/plugins/vuecs-locale.ts
  • apps/client-web/plugins/vuecs.ts
  • apps/server-core/src/adapters/http/controllers/workflows/activate/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/password-forgot/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/password-reset/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/register/module.ts
  • apps/server-core/src/adapters/http/controllers/workflows/status/module.ts
  • apps/server-core/src/adapters/http/request/helpers/index.ts
  • apps/server-core/src/adapters/http/request/helpers/redirect.ts
  • apps/server-core/src/adapters/http/ui/index.ts
  • apps/server-core/src/adapters/http/ui/render.ts
  • apps/server-core/src/adapters/http/ui/serve.ts
  • apps/server-core/src/app/modules/config/normalize.ts
  • apps/server-core/src/app/modules/http/modules/controller.ts
  • apps/server-core/src/core/entities/client/web-client.ts
  • apps/server-core/src/core/identity/password-recovery/service.ts
  • apps/server-core/src/core/identity/password-recovery/types.ts
  • apps/server-core/src/core/identity/registration/service.ts
  • apps/server-core/src/core/identity/registration/types.ts
  • apps/server-core/src/core/identity/role/module.ts
  • apps/server-core/src/core/mail/index.ts
  • apps/server-core/src/core/mail/renderer.ts
  • apps/server-core/src/core/mail/templates.ts
  • apps/server-core/src/core/mail/types.ts
  • apps/server-core/test/unit/adapters/http/request/redirect.spec.ts
  • apps/server-core/test/unit/core/entities/realm/service.spec.ts
  • apps/server-core/test/unit/core/identity/password-recovery/service.spec.ts
  • apps/server-core/test/unit/core/identity/registration/service.spec.ts
  • apps/server-core/test/unit/core/identity/role/module.spec.ts
  • apps/server-core/test/unit/core/mail/renderer.spec.ts
  • apps/server-core/ui/src/App.vue
  • apps/server-core/ui/src/app.ts
  • apps/server-core/ui/src/cookie.ts
  • apps/server-core/ui/src/pages/activate.vue
  • apps/server-core/ui/src/window.ts
  • packages/client-web-kit/package.json
  • packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue
  • packages/client-web-kit/src/components/utility/AAuthBackLink.vue
  • packages/client-web-kit/src/components/utility/AAuthGadgets.vue
  • packages/client-web-kit/src/components/utility/ALanguageSwitcherDropdown.ts
  • packages/client-web-kit/src/components/utility/index.ts
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue
  • packages/client-web-kit/src/components/workflows/password/PasswordForgotForm.vue
  • packages/client-web-kit/src/components/workflows/password/PasswordResetForm.vue
  • packages/client-web-kit/src/components/workflows/register/ActivateForm.vue
  • packages/client-web-kit/src/components/workflows/register/RegisterForm.vue
  • packages/client-web-kit/src/core/oauth2/pkce.ts
  • packages/client-web-kit/src/core/translator/index.ts
  • packages/client-web-kit/src/core/translator/locale.ts
  • packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts
  • packages/i18n/src/locales.ts
✅ Files skipped from review due to trivial changes (7)
  • packages/client-web-kit/src/core/translator/index.ts
  • apps/client-web/plugins/vuecs-locale.ts
  • apps/server-core/src/core/mail/index.ts
  • apps/server-core/src/adapters/http/request/helpers/index.ts
  • apps/server-core/src/core/mail/templates.ts
  • apps/server-core/src/core/identity/password-recovery/types.ts
  • .agents/architecture.md
🚧 Files skipped from review as they are similar to previous changes (14)
  • apps/server-core/src/adapters/http/ui/index.ts
  • packages/client-web-kit/src/components/utility/index.ts
  • apps/server-core/test/unit/core/entities/realm/service.spec.ts
  • packages/client-web-kit/package.json
  • apps/server-core/src/core/entities/client/web-client.ts
  • apps/server-core/src/app/modules/config/normalize.ts
  • packages/client-web-kit/src/components/workflows/register/RegisterForm.vue
  • packages/client-web-nuxt/src/runtime/helpers/routing-interceptor.ts
  • packages/client-web-kit/src/components/entities/realm/ARealmGrid.vue
  • packages/client-web-kit/src/components/workflows/password/PasswordForgotForm.vue
  • apps/server-core/src/app/modules/http/modules/controller.ts
  • packages/client-web-kit/src/components/workflows/password/PasswordResetForm.vue
  • apps/server-core/src/core/identity/registration/service.ts
  • packages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vue

Comment on lines +7 to +14
<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent } from 'vue';
import type { LinkProperties } from '@vuecs/link';
import { VCLink } from '@vuecs/link';
import { TranslatorTranslationClientKey, TranslatorTranslationNamespace } from '@authup/i18n';
import { useTranslations } from '../../core';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing import for VCIcon component.

The template uses VCIcon at Line 42, but the component is never imported in the script section. This will cause a runtime error when the component tries to render.

🔧 Proposed fix
 import type { PropType } from 'vue';
 import { defineComponent } from 'vue';
 import type { LinkProperties } from '`@vuecs/link`';
-import { VCLink } from '`@vuecs/link`';
+import { VCLink, VCIcon } from '`@vuecs/link`';
 import { TranslatorTranslationClientKey, TranslatorTranslationNamespace } from '`@authup/i18n`';
 import { useTranslations } from '../../core';

and register the component:

 export default defineComponent({
-    components: { VCLink },
+    components: { VCLink, VCIcon },
     props: { link: { type: Object as PropType<LinkProperties> } },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/client-web-kit/src/components/utility/AAuthBackLink.vue` around
lines 7 - 14, The template uses VCIcon but it is not imported or registered;
import VCIcon (the component used in the template) alongside VCLink in the
script and add it to the components option inside the defineComponent call
(e.g., components: { VCLink, VCIcon }) so VCIcon is available at runtime when
rendering AAuthBackLink.vue.

tada5hi added 2 commits June 10, 2026 15:19
- sanitizeRelativeRedirect: also reject control chars in the decoded form
  so a percent-encoded CRLF (%0a/%0d) can't smuggle a header-injection
  vector past the raw-input check; keep accepting a legit encoded space
  (%20) by excluding 0x20 from the decoded check
- MailTemplateRenderer: html-escape the action url before the href
  attribute (defense-in-depth — values are internal today, but
  interpolation must treat them as untrusted)
- tests for both (encoded CR/LF rejection; url attribute-breakout escape)
The SSR pass and first hydration frame run before onMounted's load(),
so the grid painted the "no results" branch with ilingo's unresolved
namespace.key fallback (authupCommon.noResults) instead of the loading
skeleton. Track a loaded flag and show the skeleton until the first
load settles.
@tada5hi tada5hi changed the title feat: per-realm public web client and realm-selection login feat: per-realm web client login, realm chooser & backend-served auth workflow UI Jun 10, 2026
@tada5hi
tada5hi merged commit 80a1cce into master Jun 10, 2026
12 of 14 checks passed
@tada5hi
tada5hi deleted the feat/per-realm-web-client-login branch June 10, 2026 16:48
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
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.

2 participants