Skip to content

Add local account management controls - #978

Open
CoderLuii wants to merge 1 commit into
siteboon:mainfrom
CoderLuii:agent/local-account-management
Open

Add local account management controls#978
CoderLuii wants to merge 1 commit into
siteboon:mainfrom
CoderLuii:agent/local-account-management

Conversation

@CoderLuii

@CoderLuii CoderLuii commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add Account settings with Logout and Change Password controls for local installs
  • rotate the authentication generation after a password change so older REST, query-token, SSE, and WebSocket tokens stop working
  • keep platform mode excluded from local password management
  • recognize direct Account tab links, translate the sidebar label, and announce account errors to assistive technology
  • keep password hashing outside the shared SQLite transaction and reuse one token-generation config key

Why

Local installs can create an account during setup, but they had no UI path to log out or change that password afterward. Deleting local authentication state is not a safe account-management workflow.

Fixes #797.

Validation

  • npm ci
  • npx tsx --tsconfig server/tsconfig.json --test server/modules/auth/tests/auth.service.test.ts (9 tests)
  • npx tsx --test src/components/settings/hooks/useSettingsController.test.ts src/components/settings/view/tabs/AccountSettingsTab.test.ts (5 tests)
  • npm run typecheck
  • npm run build
  • npm run lint (0 errors; existing warnings remain)
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds local account settings with logout and password change controls, a change-password API and service flow, active-user persistence operations, and JWT token-generation rotation that invalidates prior sessions.

Changes

Account Settings and Change Password

Layer / File(s) Summary
JWT token-generation invalidation
server/modules/auth/auth.middleware.ts, server/modules/auth/auth.module.ts, server/modules/database/repositories/app-config.ts
Persists token generations, embeds them in new JWTs, and rejects stale REST or WebSocket tokens.
Change-password backend flow
server/modules/auth/auth.service.ts, server/modules/auth/auth.routes.ts, server/modules/database/repositories/users.ts, server/modules/auth/tests/auth.service.test.ts
Validates credentials, updates active-user password hashes transactionally, rotates token generation, and tests success and failure cases.
Frontend authentication wiring
src/utils/api.js, src/components/auth/context/AuthContext.tsx, src/components/auth/types.ts
Adds the authenticated password-change request, structured errors, session clearing, and context typing.
Account tab navigation
src/components/settings/types/types.ts, src/components/settings/hooks/*, src/components/settings/constants/constants.ts, src/components/settings/view/Settings*.tsx
Adds the Account tab, icon, sidebar entry, label fallback, normalization, and rendering path.
Account controls and validation
src/components/settings/view/tabs/AccountSettingsTab.tsx, src/components/settings/view/tabs/accountSettings.ts, src/components/settings/view/tabs/*.test.ts
Adds logout, platform-mode messaging, controlled password fields, validation, loading state, alerts, and tests.

Sequence Diagram(s)

sequenceDiagram
  participant AccountSettingsTab
  participant AuthContext
  participant AuthRoute
  participant AuthService
  participant UserDb
  participant AppConfigDb
  AccountSettingsTab->>AuthContext: Submit current and new passwords
  AuthContext->>AuthRoute: POST /api/auth/change-password
  AuthRoute->>AuthService: Validate and change password
  AuthService->>UserDb: Read user and update password hash
  AuthService->>AppConfigDb: Store new token generation
  AuthService-->>AuthContext: Return success or error
  AuthContext-->>AccountSettingsTab: Clear session or display error
Loading

Possibly related PRs

Poem

A rabbit found a password door,
And gave old tokens leave to roam.
“Account!” the sidebar sings anew,
With logout waiting there for you.
New hashes hop through guarded code—
Then bouncy sessions lighten the load.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds a Logout action in Settings, satisfying the requested UI sign-out control for issue #797.
Out of Scope Changes check ✅ Passed The added password-change and token-rotation work stays within the new account-management feature set, so no unrelated changes stand out.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding local account management controls like logout and password change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
server/routes/auth.js (1)

38-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Message text drifts from PASSWORD_MIN_LENGTH.

The validations use PASSWORD_MIN_LENGTH, but the error strings hardcode "6 characters" (Line 39 and Line 148). If the constant changes, the messages will be misleading. Consider interpolating the constant.

♻️ Interpolate the constant
-      return res.status(400).json({ error: 'New password must be at least 6 characters' });
+      return res.status(400).json({ error: `New password must be at least ${PASSWORD_MIN_LENGTH} characters` });

Line 39 (registration) can be updated similarly.

Also applies to: 147-149

🤖 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 `@server/routes/auth.js` around lines 38 - 40, The validation error messages in
the auth flow are hardcoding the password length instead of reflecting
PASSWORD_MIN_LENGTH. Update the response strings in the registration and related
checks within auth.js to interpolate PASSWORD_MIN_LENGTH so the message stays
aligned with the actual validation logic. Use the existing validation branches
around the username/password checks and keep the wording consistent across both
occurrences.
src/components/settings/view/tabs/AccountSettingsTab.tsx (1)

28-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse a shared minimum-length constant instead of hardcoding 6.

The length check and its message hardcode 6, while the server validates against PASSWORD_MIN_LENGTH (server/routes/auth.js). If that constant changes, this client validation and copy silently drift out of sync. Consider importing/deriving a shared constant and interpolating it into the message.

🤖 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 `@src/components/settings/view/tabs/AccountSettingsTab.tsx` around lines 28 -
30, The password validation in AccountSettingsTab is hardcoding the minimum
length, which can drift from the server’s PASSWORD_MIN_LENGTH. Update the logic
in the validation flow that checks formState.newPassword so it uses a shared
minimum-length constant instead of a literal 6, and make the returned error
message interpolate that same constant. Keep the client-side check and copy
aligned with the server-side password rule.
🤖 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 `@src/components/settings/types/types.ts`:
- Line 6: The settings tab normalization is missing the new 'account' tab, so
URL/command-palette navigation falls back to 'agents' instead of opening
account. Update the KNOWN_MAIN_TABS array in useSettingsController.ts to include
'account' so normalizeMainTab recognizes it, and keep it aligned with the
SettingsMainTab union in types.ts.

In `@src/components/settings/view/tabs/AccountSettingsTab.tsx`:
- Around line 153-157: The error message in AccountSettingsTab is only visible
and not announced to assistive tech. Update the error container rendered in the
error && block to use an alert announcement pattern, such as adding role="alert"
or an appropriate aria-live region, so validation and submission failures are
surfaced by screen readers. Keep the change localized to the error UI in
AccountSettingsTab.

---

Nitpick comments:
In `@server/routes/auth.js`:
- Around line 38-40: The validation error messages in the auth flow are
hardcoding the password length instead of reflecting PASSWORD_MIN_LENGTH. Update
the response strings in the registration and related checks within auth.js to
interpolate PASSWORD_MIN_LENGTH so the message stays aligned with the actual
validation logic. Use the existing validation branches around the
username/password checks and keep the wording consistent across both
occurrences.

In `@src/components/settings/view/tabs/AccountSettingsTab.tsx`:
- Around line 28-30: The password validation in AccountSettingsTab is hardcoding
the minimum length, which can drift from the server’s PASSWORD_MIN_LENGTH.
Update the logic in the validation flow that checks formState.newPassword so it
uses a shared minimum-length constant instead of a literal 6, and make the
returned error message interpolate that same constant. Keep the client-side
check and copy aligned with the server-side password rule.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8d89ef01-1cf3-4fa2-927e-8de224179af0

📥 Commits

Reviewing files that changed from the base of the PR and between 5884573 and 60c9003.

📒 Files selected for processing (13)
  • server/middleware/auth.js
  • server/modules/database/repositories/app-config.ts
  • server/modules/database/repositories/users.ts
  • server/routes/auth.js
  • src/components/auth/context/AuthContext.tsx
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • src/components/settings/types/types.ts
  • src/components/settings/view/Settings.tsx
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/settings/view/SettingsSidebar.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • src/utils/api.js

Comment thread src/components/settings/types/types.ts
Comment thread src/components/settings/view/tabs/AccountSettingsTab.tsx
@CoderLuii
CoderLuii force-pushed the agent/local-account-management branch from 60c9003 to 14218c5 Compare July 29, 2026 17:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/components/settings/hooks/useSettingsController.test.ts (1)

5-9: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Replace source-text assertions with behavioral tests. Both tests can pass while the corresponding runtime behavior is broken because they only search for string literals and markup in source files.

  • src/components/settings/hooks/useSettingsController.test.ts#L5-L9: execute normalizeMainTab('account') and assert it returns 'account'.
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts#L5-L15: render and submit the form, then assert validation and accessible error announcements through the user-visible DOM.
🤖 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 `@src/components/settings/hooks/useSettingsController.test.ts` around lines 5 -
9, Replace the source-text assertion in
src/components/settings/hooks/useSettingsController.test.ts lines 5-9 with a
behavioral test that calls normalizeMainTab('account') and asserts it returns
'account'. In src/components/settings/view/tabs/AccountSettingsTab.test.ts lines
5-15, replace source inspection with a rendered form submission test that
verifies validation messages and accessible error announcements through the
user-visible DOM.
server/routes/auth.account-management.test.js (1)

5-8: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Test the route behavior instead of source text.

This passes even if password verification, hash persistence, or token rotation is broken. Add route-level tests for successful change, wrong current password, validation failures, platform mode, and generation rotation.

🤖 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 `@server/routes/auth.account-management.test.js` around lines 5 - 8, Replace
the source-text assertion in the registration/password-change test with
route-level tests exercising the auth account-management handlers. Cover
successful password changes, rejection of an incorrect current password,
validation failures, platform-mode behavior, and generation/token rotation,
verifying persisted hashes and issued or invalidated tokens where applicable.
🤖 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 `@src/components/settings/view/tabs/AccountSettingsTab.tsx`:
- Around line 62-71: Update the password-save flow around changePassword so
rejected promises are handled and setIsSaving(false) always executes via a
finally block. Preserve the existing unsuccessful-result error handling and
successful form reset behavior, while ensuring the saving state is cleared for
both resolved and rejected requests.

---

Nitpick comments:
In `@server/routes/auth.account-management.test.js`:
- Around line 5-8: Replace the source-text assertion in the
registration/password-change test with route-level tests exercising the auth
account-management handlers. Cover successful password changes, rejection of an
incorrect current password, validation failures, platform-mode behavior, and
generation/token rotation, verifying persisted hashes and issued or invalidated
tokens where applicable.

In `@src/components/settings/hooks/useSettingsController.test.ts`:
- Around line 5-9: Replace the source-text assertion in
src/components/settings/hooks/useSettingsController.test.ts lines 5-9 with a
behavioral test that calls normalizeMainTab('account') and asserts it returns
'account'. In src/components/settings/view/tabs/AccountSettingsTab.test.ts lines
5-15, replace source inspection with a rendered form submission test that
verifies validation messages and accessible error announcements through the
user-visible DOM.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83ac9376-eae2-4d32-bdb5-a7be7da3c82e

📥 Commits

Reviewing files that changed from the base of the PR and between 60c9003 and 14218c5.

📒 Files selected for processing (17)
  • server/middleware/auth.js
  • server/modules/database/repositories/app-config.ts
  • server/modules/database/repositories/users.ts
  • server/routes/auth.account-management.test.js
  • server/routes/auth.js
  • src/components/auth/context/AuthContext.tsx
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • src/components/settings/hooks/useSettingsController.test.ts
  • src/components/settings/hooks/useSettingsController.ts
  • src/components/settings/types/types.ts
  • src/components/settings/view/Settings.tsx
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/settings/view/SettingsSidebar.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • src/utils/api.js
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/components/auth/types.ts
  • src/components/settings/view/Settings.tsx
  • server/middleware/auth.js
  • src/components/settings/view/SettingsMainTabs.tsx
  • server/modules/database/repositories/users.ts
  • src/utils/api.js
  • src/components/auth/context/AuthContext.tsx
  • src/components/settings/view/SettingsSidebar.tsx
  • server/modules/database/repositories/app-config.ts

Comment thread src/components/settings/view/tabs/AccountSettingsTab.tsx Outdated
@CoderLuii
CoderLuii force-pushed the agent/local-account-management branch from 14218c5 to 7faf587 Compare July 29, 2026 18:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@src/components/settings/hooks/normalizeMainTab.ts`:
- Line 3: Update the KNOWN_MAIN_TABS allowlist to include the existing 'voice'
SettingsMainTab value, and extend the normalizeMainTab test coverage to verify
that 'voice' remains unchanged instead of normalizing to 'agents'.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c4730149-77f8-4b0b-9753-018f790493d5

📥 Commits

Reviewing files that changed from the base of the PR and between 14218c5 and 7faf587.

📒 Files selected for processing (20)
  • server/middleware/auth.js
  • server/modules/database/repositories/app-config.ts
  • server/modules/database/repositories/users.ts
  • server/routes/auth.account-management.platform.test.js
  • server/routes/auth.account-management.test.js
  • server/routes/auth.js
  • src/components/auth/context/AuthContext.tsx
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • src/components/settings/hooks/normalizeMainTab.ts
  • src/components/settings/hooks/useSettingsController.test.ts
  • src/components/settings/hooks/useSettingsController.ts
  • src/components/settings/types/types.ts
  • src/components/settings/view/Settings.tsx
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/settings/view/SettingsSidebar.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • src/components/settings/view/tabs/accountSettings.ts
  • src/utils/api.js
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/components/settings/view/Settings.tsx
  • server/modules/database/repositories/app-config.ts
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/view/SettingsMainTabs.tsx
  • server/middleware/auth.js
  • src/components/auth/types.ts
  • server/modules/database/repositories/users.ts
  • server/routes/auth.js
  • src/components/settings/constants/constants.ts
  • src/utils/api.js
  • src/components/auth/context/AuthContext.tsx

Comment thread src/components/settings/hooks/normalizeMainTab.ts Outdated
@CoderLuii
CoderLuii force-pushed the agent/local-account-management branch from 7faf587 to 1503296 Compare July 29, 2026 19:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@server/routes/auth.account-management.platform.test.js`:
- Around line 9-29: Update the test “rejects password changes in platform mode”
so it captures the original DATABASE_PATH and VITE_IS_PLATFORM values, performs
all database, import, user, server, and address setup inside the guaranteed
try/finally cleanup path, and conditionally closes the server when startup
succeeded. Restore each environment variable to its prior value, deleting it
only when it was originally absent, and retain cleanup for the temporary
directory and database connection.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ee54188b-364b-4794-b8c0-48e81316d1a3

📥 Commits

Reviewing files that changed from the base of the PR and between 7faf587 and 1503296.

📒 Files selected for processing (20)
  • server/middleware/auth.js
  • server/modules/database/repositories/app-config.ts
  • server/modules/database/repositories/users.ts
  • server/routes/auth.account-management.platform.test.js
  • server/routes/auth.account-management.test.js
  • server/routes/auth.js
  • src/components/auth/context/AuthContext.tsx
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • src/components/settings/hooks/normalizeMainTab.ts
  • src/components/settings/hooks/useSettingsController.test.ts
  • src/components/settings/hooks/useSettingsController.ts
  • src/components/settings/types/types.ts
  • src/components/settings/view/Settings.tsx
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/settings/view/SettingsSidebar.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • src/components/settings/view/tabs/accountSettings.ts
  • src/utils/api.js
🚧 Files skipped from review as they are similar to previous changes (17)
  • src/components/settings/hooks/normalizeMainTab.ts
  • src/components/settings/hooks/useSettingsController.test.ts
  • src/components/settings/types/types.ts
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • server/modules/database/repositories/users.ts
  • src/components/settings/view/tabs/accountSettings.ts
  • src/components/settings/view/SettingsSidebar.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • server/modules/database/repositories/app-config.ts
  • server/routes/auth.account-management.test.js
  • src/utils/api.js
  • server/routes/auth.js
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/hooks/useSettingsController.ts
  • src/components/auth/context/AuthContext.tsx

Comment thread server/routes/auth.account-management.platform.test.js Outdated
@CoderLuii
CoderLuii force-pushed the agent/local-account-management branch from 1503296 to d5df608 Compare July 29, 2026 19:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
server/modules/auth/auth.service.ts (1)

75-105: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Async hashPassword runs while a raw SQLite transaction is open.

register calls transaction.begin() then awaits hashPassword before createUser/commit. SQLite BEGIN...COMMIT transactions don't nest — a second concurrent call to transaction.begin() on the same shared connection (e.g., a duplicate double-submitted register request racing before the first commits) throws cannot start a transaction within a transaction instead of the intended AUTH_USER_ALREADY_CONFIGURED 403. changePassword avoids this correctly by hashing before begin() (lines 188-190) — apply the same ordering here.

🔧 Proposed fix
-      dependencies.transaction.begin();
-      try {
-        if (dependencies.users.hasUsers()) {
-          throw new AppError('User already exists. This is a single-user system.', {
-            code: 'AUTH_USER_ALREADY_CONFIGURED',
-            statusCode: 403,
-          });
-        }
-
-        const passwordHash = await dependencies.hashPassword(password);
-        const user = dependencies.users.createUser(username, passwordHash);
+      const passwordHash = await dependencies.hashPassword(password);
+      dependencies.transaction.begin();
+      try {
+        if (dependencies.users.hasUsers()) {
+          throw new AppError('User already exists. This is a single-user system.', {
+            code: 'AUTH_USER_ALREADY_CONFIGURED',
+            statusCode: 403,
+          });
+        }
+
+        const user = dependencies.users.createUser(username, passwordHash);
🤖 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 `@server/modules/auth/auth.service.ts` around lines 75 - 105, Move the
asynchronous dependencies.hashPassword(password) call in register before
dependencies.transaction.begin(), then begin the transaction only after hashing
completes. Preserve the existing user-existence check, createUser, commit,
rollback, and error-mapping behavior while matching the ordering used by
changePassword.
🧹 Nitpick comments (2)
server/modules/auth/auth.middleware.ts (1)

8-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shared config key 'auth_token_generation' is duplicated as separate literals across files. Both sites hardcode the same app-config key independently; a rename in either place silently breaks the token-generation invalidation feature with no compile-time signal.

  • server/modules/auth/auth.middleware.ts#L8-L22: keep AUTH_TOKEN_GENERATION_KEY here but export it (or move it to a shared constants module).
  • server/modules/auth/auth.module.ts#L21-L43: import the shared constant instead of re-hardcoding 'auth_token_generation' on line 31.
🤖 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 `@server/modules/auth/auth.middleware.ts` around lines 8 - 22, Export the
existing AUTH_TOKEN_GENERATION_KEY from server/modules/auth/auth.middleware.ts,
then update server/modules/auth/auth.module.ts to import and reuse it instead of
hardcoding the 'auth_token_generation' literal. Keep the key definition
centralized and preserve existing token-generation behavior at both sites.
server/modules/auth/tests/auth.service.test.ts (1)

163-198: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for changePassword's auth-guard branches.

No test exercises AUTH_USER_REQUIRED (malformed userInput) or AUTH_TOKEN_INVALID (authenticated user row missing via getUserAuthById) — both are security-relevant guards in changePassword.

🤖 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 `@server/modules/auth/tests/auth.service.test.ts` around lines 163 - 198, Add
tests covering the auth-guard branches in changePassword: pass malformed
userInput and assert an AppError with code AUTH_USER_REQUIRED, then configure
getUserAuthById to return undefined for otherwise valid input and assert
AUTH_TOKEN_INVALID. Keep these cases focused on the guards and verify the
expected error codes.
🤖 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 `@src/components/settings/view/SettingsSidebar.tsx`:
- Around line 20-21: Update the account entry in NAV_ITEMS within
SettingsSidebar to use the translation key tabs.account via labelKey instead of
the hardcoded Account label, preserving the existing id and icon.

---

Outside diff comments:
In `@server/modules/auth/auth.service.ts`:
- Around line 75-105: Move the asynchronous dependencies.hashPassword(password)
call in register before dependencies.transaction.begin(), then begin the
transaction only after hashing completes. Preserve the existing user-existence
check, createUser, commit, rollback, and error-mapping behavior while matching
the ordering used by changePassword.

---

Nitpick comments:
In `@server/modules/auth/auth.middleware.ts`:
- Around line 8-22: Export the existing AUTH_TOKEN_GENERATION_KEY from
server/modules/auth/auth.middleware.ts, then update
server/modules/auth/auth.module.ts to import and reuse it instead of hardcoding
the 'auth_token_generation' literal. Keep the key definition centralized and
preserve existing token-generation behavior at both sites.

In `@server/modules/auth/tests/auth.service.test.ts`:
- Around line 163-198: Add tests covering the auth-guard branches in
changePassword: pass malformed userInput and assert an AppError with code
AUTH_USER_REQUIRED, then configure getUserAuthById to return undefined for
otherwise valid input and assert AUTH_TOKEN_INVALID. Keep these cases focused on
the guards and verify the expected error codes.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca22b960-ca0f-42b2-beb0-c474c238a043

📥 Commits

Reviewing files that changed from the base of the PR and between 1503296 and d5df608.

📒 Files selected for processing (21)
  • server/modules/auth/auth.middleware.ts
  • server/modules/auth/auth.module.ts
  • server/modules/auth/auth.routes.ts
  • server/modules/auth/auth.service.ts
  • server/modules/auth/tests/auth.service.test.ts
  • server/modules/database/repositories/app-config.ts
  • server/modules/database/repositories/users.ts
  • src/components/auth/context/AuthContext.tsx
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • src/components/settings/hooks/normalizeMainTab.ts
  • src/components/settings/hooks/useSettingsController.test.ts
  • src/components/settings/hooks/useSettingsController.ts
  • src/components/settings/types/types.ts
  • src/components/settings/view/Settings.tsx
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/settings/view/SettingsSidebar.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • src/components/settings/view/tabs/accountSettings.ts
  • src/utils/api.js
🚧 Files skipped from review as they are similar to previous changes (15)
  • src/components/settings/types/types.ts
  • src/components/settings/view/tabs/AccountSettingsTab.test.ts
  • src/components/settings/view/Settings.tsx
  • src/components/settings/hooks/normalizeMainTab.ts
  • src/utils/api.js
  • src/components/settings/hooks/useSettingsController.test.ts
  • src/components/settings/view/SettingsMainTabs.tsx
  • src/components/auth/types.ts
  • src/components/settings/constants/constants.ts
  • server/modules/database/repositories/users.ts
  • server/modules/database/repositories/app-config.ts
  • src/components/auth/context/AuthContext.tsx
  • src/components/settings/view/tabs/AccountSettingsTab.tsx
  • src/components/settings/hooks/useSettingsController.ts
  • src/components/settings/view/tabs/accountSettings.ts

Comment thread src/components/settings/view/SettingsSidebar.tsx Outdated
@CoderLuii
CoderLuii force-pushed the agent/local-account-management branch from d5df608 to 48e7631 Compare July 29, 2026 19:59
CoderLuii added a commit to CoderLuii/HolyClaude that referenced this pull request Jul 30, 2026
Refresh compatible agent CLIs, package tooling, Python libraries, scanners, and immutable release inputs while preserving HolyClaude's Docker interfaces.

Rebuild CloudCLI 1.36.3 with the reviewed upload, WebSocket, account-management, and dependency protections, then bind those versions and behaviors to source and image-level tests.

Strengthen release evidence, rollback handling, product-fact validation, and rootless documentation without changing ports, volumes, variants, or runtime configuration.

Constraint: Keep Node 26.5.0 Bookworm, Debian Chromium 150.0.7871.181, npm 11.18.0, and Playwright 1.61.0

Rejected: Delay compatible dependency and security updates for unavailable Node and Chromium packages | retain the verified base inputs for this release

Security: Remove the targeted ws, Multer, DOMPurify, Express, and path-to-regexp findings from the vendored CloudCLI production tree

Confidence: high

Scope-risk: broad

Directive: Promote only the four release-branch candidate digests that pass native builds, security policy, and runtime smokes

Tested: 167 Node tests; 5 Python tests; shell syntax; product-facts validation; immutable-input validation; actionlint; no-cache slim and full amd64 builds; browser, persistence, rootless, CloudCLI-volume, and full-only runtime smokes

Not-tested: Native arm64 candidates, digest-bound final scans, registry promotion, and post-publish smokes remain gated by GitHub Actions

Related: siteboon/claudecodeui#978, siteboon/claudecodeui#1070
CoderLuii added a commit to CoderLuii/HolyClaude that referenced this pull request Jul 30, 2026
Refresh compatible agent CLIs, package tooling, Python libraries, scanners, and immutable release inputs while preserving HolyClaude's Docker interfaces.

Rebuild CloudCLI 1.36.3 with the reviewed upload, WebSocket, account-management, and dependency protections, then bind those versions and behaviors to source and image-level tests.

Strengthen release evidence, rollback handling, product-fact validation, and rootless documentation without changing ports, volumes, variants, or runtime configuration.

Constraint: Keep Node 26.5.0 Bookworm, Debian Chromium 150.0.7871.181, npm 11.18.0, and Playwright 1.61.0

Rejected: Delay compatible dependency and security updates for unavailable Node and Chromium packages | retain the verified base inputs for this release

Security: Remove the targeted ws, Multer, DOMPurify, Express, and path-to-regexp findings from the vendored CloudCLI production tree

Confidence: high

Scope-risk: broad

Directive: Promote only the four release-branch candidate digests that pass native builds, security policy, and runtime smokes

Tested: 167 Node tests; 5 Python tests; shell syntax; product-facts validation; immutable-input validation; actionlint; no-cache slim and full amd64 builds; browser, persistence, rootless, CloudCLI-volume, and full-only runtime smokes

Not-tested: Native arm64 candidates, digest-bound final scans, registry promotion, and post-publish smokes remain gated by GitHub Actions

Related: siteboon/claudecodeui#978, siteboon/claudecodeui#1070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Logout Button in UI

2 participants