Commit Graph
7 Commits
Author SHA1 Message Date
Tam Nhu Tran 5a09547532 fix(auth): signal auth-required for remote access in /api/auth/check
The auth check endpoint always returned authRequired=false when auth
was disabled, even for remote clients. This caused the UI to render
the dashboard directly, where all data API calls return 403 silently.

Now detects remote access via isLoopbackRemoteAddress and sets
effectiveAuthRequired=true, so the UI properly redirects to the login
page. Also fixes misleading catch handler comment in auth-context.
2026-03-29 10:54:44 -04:00
Tam Nhu Tran e9fceed807 fix(ui): redirect to login when auth check fails from remote access
When the auth check API call fails (e.g., 403 from the localhost
security middleware), the catch block assumed no auth was needed and
marked the user as authenticated. This caused a silently broken
dashboard with no providers and no error feedback.

Now treats auth check failure as auth-required, redirecting to the
login page where users get a clear prompt to configure credentials.
2026-03-28 21:22:20 -04:00
kaitranntt 464b410e8b feat(dashboard): add optional login authentication (#319)
Add session-based username/password auth for CCS dashboard:
- Backend: Express session middleware with bcrypt password verification
- Frontend: React AuthContext, login page, protected routes
- Config: dashboard_auth section in config.yaml + env var overrides
- Security: Rate limiting (5 attempts/15min), persistent session secret
- 16 unit tests for auth middleware

Auth disabled by default for backward compatibility.
2026-01-13 13:27:38 -05:00
kaitranntt f15b989508 fix(hooks): memoize return objects to prevent infinite render loops
Apply useMemo to hook returns that create new object references on each
render. This prevents downstream useEffect/useCallback dependencies from
detecting false changes and triggering re-execution.

Fixed hooks:
- PrivacyProvider: memoize context value and toggle callback
- useCopilot: wrap large return object with all dependencies
- useWebSocket: memoize status/connect/disconnect object
- useProjectSelection: memoize state and handlers object
- useCliproxyAuthFlow: memoize spread state with auth functions
- useAnalyticsPage: memoize apiOptions to stabilize query params
2025-12-21 04:17:32 -05:00
kaitranntt 6f3fb54cc3 feat(privacy): add privacy/demo mode for personal info blurring 2025-12-17 02:24:36 -05:00
kaitranntt 28202bac0d refactor(ui): architecture and layout 2025-12-12 17:43:06 -05:00
kaitranntt 707af2f01a feat(ui): add comprehensive quality gates and fix linting issues
- Added ESLint, Prettier, TypeScript strict mode to ui/ directory
- Fixed 40+ lint/format issues across ui codebase
- Created extraction files for react-refresh compliance:
  - button-variants.ts for Button component styles
  - use-sidebar.ts, use-websocket-context.ts custom hooks
  - ws-context.ts WebSocket context provider
- Fixed React hooks issues (setState ordering, dependency arrays)
- Added ui:validate script to enforce quality checks
- Updated husky pre-commit to validate UI files on change
2025-12-07 14:51:29 -05:00