fix(ui): audit remediation for auth, errors, and environment handling - #302
Merged
Conversation
Tighten session handling and API error paths after a full-stack audit: smarter 401 redirects, secure cookie defaults aligned with JWT lifetime, canonical multi-env names, and shared api-error helpers.
Pure cookie utility functions must not live in a use server module — Next.js requires all exports there to be async Server Actions. Also tighten SessionCookieOptions so value is always required for cookies().set().
Closed
5 tasks
kkopanidis
approved these changes
Jul 31, 2026
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
Follow-up fixes from a full-stack audit of Conduit and Conduit-UI. This PR tightens session handling, API error paths, and multi-environment configuration in the admin panel.
/login,/verify-twofa) are excluded so failed logins do not loop.secure,sameSite: 'lax', andmaxAgederived from the JWT expiry instead of a fixed duration.EnvManagerso cookie names stay consistent across mixed-case inputs.communications-api-error.tswithapi-error.tsfor consistent Axios and communications error formatting across modules.getSchemaDocumentrethrows non-404 errors instead of swallowing them.Why
The audit found that loose 401 redirects and mismatched cookie names could cause false logouts or broken session-timeout flows on remote environments. Fixed cookie lifetimes and env name normalization reduce those failures. Centralized error helpers make API failures easier to diagnose in production.
Related PRs
/communications/templatesand/communications/test.Test plan
/login?session-timeout=true/