Commit graph

67 commits

Author SHA1 Message Date
Chris
c2e9a1aa21
feat: Add OIDC/SSO authentication support (#1008)
* feat: add OIDC/SSO database schema and models (Phase 1)

Add database foundation for OpenID Connect authentication:

Database Migrations:
- Create oidc_identities table (links users to OIDC accounts)
- Create oidc_state_nonces table (OAuth state/nonce for CSRF protection)
- Create auth_audit_log table (security event logging)
- Make password_digest nullable in users table (allow OIDC-only users)

Models:
- OIDCIdentity: Links users to external OIDC providers
- OIDCStateNonce: Temporary OAuth state management
- AuthAuditLog: Authentication event audit trail

Changes:
- Updated User model to allow null password_digest
- Added model associations in models/index.js
- All migrations tested and verified

Related to #977

* feat: add OIDC core services (Phase 2)

- Install openid-client@^6.2.0 for OIDC protocol support
- Implement providerConfig.js for loading providers from .env
  - Support single provider or numbered providers (OIDC_PROVIDER_1_*, etc.)
  - Auto-provision and admin email domain configuration
  - Provider caching for performance
- Implement stateManager.js for OAuth state/nonce management
  - CSRF protection with 10-minute TTL
  - One-time use state consumption
  - Automatic cleanup of expired states
- Implement auditService.js for authentication event logging
  - Track login success/failure, logout, OIDC linking/unlinking
  - Store IP address, user agent, and metadata
  - Support for event queries and retention cleanup
- Add comprehensive unit tests (60 tests, all passing)
  - providerConfig: 36 tests for env parsing and validation
  - stateManager: 12 tests for state lifecycle and security
  - auditService: 12 tests for event logging and queries

Phase 2 completes the backend core services needed for OIDC authentication.

* feat: implement OIDC authentication flow (Phase 3)

Core OIDC Flow (service.js):
- Provider discovery with issuer caching
- Authorization URL generation with state/nonce
- OAuth callback handling and token exchange
- ID token validation using openid-client
- Token refresh functionality

JIT User Provisioning (provisioningService.js):
- Auto-create users from OIDC claims
- Link existing email accounts to OIDC identities
- Admin role assignment based on email domain rules
- Automatic username generation from email
- Transaction-safe identity creation

Identity Management (oidcIdentityService.js):
- List user's linked OIDC identities
- Link additional providers to existing accounts
- Unlink identities with safety checks
- Prevent unlinking last auth method
- Update identity claims on login

HTTP Layer (controller.js + routes.js):
- GET /api/oidc/providers - List configured providers
- GET /api/oidc/auth/:slug - Initiate OIDC flow
- GET /api/oidc/callback/:slug - Handle OAuth callback
- POST /api/oidc/link/:slug - Link provider to current user
- DELETE /api/oidc/unlink/:id - Unlink identity
- GET /api/oidc/identities - Get user's identities

Integration:
- Register OIDC routes in Express app (public + authenticated)
- Update auth service to reject password login for OIDC-only users
- Audit logging for all OIDC operations
- Session creation on successful authentication

Security:
- State/nonce CSRF protection
- One-time use state consumption
- Transaction-safe user provisioning
- Foreign key constraints enforced

* feat: implement OIDC frontend login flow (Phase 4)

- Created OIDCProviderButtons component for SSO login options
- Created OIDCCallback component for OAuth callback handling
- Updated Login page to fetch and display OIDC providers
- Added /auth/callback/:provider route to App.tsx
- Added i18n translations for OIDC UI elements
- Downgraded openid-client to v5.7.0 (CommonJS compatibility)
- Fixed linting issues in backend OIDC modules

Phase 4 completes the frontend login flow for OIDC/SSO authentication.
Users can now see configured SSO providers on the login page.

* feat: implement OIDC account linking UI (Phase 5)

Add Connected Accounts section to Profile Security tab allowing users to:
- View linked OIDC provider accounts
- Link new SSO providers to their account
- Unlink OIDC identities with validation
- Prevent unlinking last authentication method

Backend changes:
- Add has_password virtual field to User model
- Include has_password in profile API response
- Track whether user has password set for validation

Frontend changes:
- Create oidcService for OIDC API operations
- Create ConnectedAccounts component with link/unlink flows
- Add confirmation dialog before unlinking accounts
- Validate that users cannot unlink their last auth method
- Show warning if user has no password set
- Integrate Connected Accounts into SecurityTab

User experience:
- View all linked SSO provider accounts with email and link date
- Link additional providers via "Link Provider" buttons
- Unlink with two-step confirmation to prevent accidents
- Clear error messages when unlinking would leave no auth method
- Warning message suggesting password setup for OIDC-only users

Fixes #977

* feat: complete OIDC documentation and UI improvements (Phase 6)

This commit completes Phase 6 of the OIDC/SSO implementation with comprehensive
documentation, bug fixes, and UI reorganization.

Documentation:
- Add comprehensive user guide at docs/10-oidc-sso.md with:
  - Setup guides for 6 major providers (Google, Okta, Keycloak, Authentik, PocketID, Azure AD)
  - Configuration examples for single and multiple providers
  - User features documentation (login, account linking, management)
  - Advanced topics (auto-provisioning, admin role assignment, hybrid auth)
  - Comprehensive troubleshooting section
  - Security considerations and best practices
- Update README.md with OIDC/SSO section and quick setup examples

Internationalization:
- Add i18n support to OIDCProviderButtons component
- Add translation keys for all OIDC UI text
- Update English translations with "sign_in_with" key

Bug Fixes:
- Fix oidcService.ts to correctly unwrap API responses
  - Backend returns {providers: [...]} and {identities: [...]}
  - Frontend was expecting plain arrays, causing "map is not a function" error
- Fix initiateOIDCLink to properly handle POST response

UI Improvements:
- Move OIDC/SSO to dedicated tab in profile settings
  - Create new OIDCTab component with green LinkIcon
  - Remove ConnectedAccounts from SecurityTab
  - Add OIDC tab between Security and API Keys tabs
  - Update ProfileSettings with new tab configuration
- Security tab now focuses solely on password management

Testing:
- All linting passes
- All tests pass (82 suites, 1223 tests)

Related to #977

* feat: add OIDC/SSO translations for all 24 languages

Add i18n support for OIDC/SSO features across all supported languages:
- "Sign in with {{provider}}" button text
- "OIDC/SSO" tab label in profile settings
- OIDC authentication flow messages

Translations added for: Arabic, Bulgarian, Danish, German, Greek, Spanish,
Finnish, French, Indonesian, Italian, Japanese, Korean, Dutch, Norwegian,
Polish, Portuguese, Romanian, Russian, Slovenian, Swedish, Turkish,
Ukrainian, Vietnamese, and Chinese.

* fix: resolve 13 CodeQL security alerts

This commit addresses critical security vulnerabilities identified by CodeQL scanning:

**Security Configuration (2 fixes)**
- Fix insecure Helmet configuration - enable CSP and HSTS in production
- Fix clear text cookie transmission - enable secure cookies in production

**Path Injection (3 fixes)**
- Add path validation in users/controller.js to prevent arbitrary file deletion
- Add path validation in users/service.js for avatar operations
- Add path sanitization in attachment-utils.js deleteFileFromDisk function

**Cross-Site Scripting (1 fix)**
- Fix XSS vulnerability in GeneralTab.tsx avatar URL handling
- Add URL sanitization to prevent javascript: protocol attacks

**URL Security (2 fixes)**
- Fix double escaping in url/service.js HTML entity decoding
- Fix incomplete URL sanitization for YouTube domain validation

**Denial of Service (1 fix)**
- Add loop bound protection in inboxProcessingService.js (10k char limit)

**Rate Limiting (3 fixes)**
- Add rate limiting to auth routes (register, verify-email)
- Add rate limiting to task attachment upload/delete endpoints
- Add rate limiting to user avatar upload/delete endpoints

**GitHub Actions Security (1 fix)**
- Add explicit read-only permissions to CI workflow

Note: CSRF middleware (#10) requires frontend changes and is tracked separately.

Relates to PR #1008

* fix: allow test files in path validation for tests

* fix: format long condition in attachment-utils for Prettier compliance

Break the path validation condition across multiple lines to meet Prettier formatting requirements and fix CI linting failure.

* fix: resolve CodeQL security alerts

- Add rate limiting to OIDC authentication routes using authLimiter and authenticatedApiLimiter
- Implement CSRF protection middleware using csrf-sync (skips for API tokens and test environment)
- Add CSRF token endpoint at /api/csrf-token
- Fix incomplete URL scheme validation in GeneralTab to block all dangerous schemes (javascript:, data:, vbscript:, file:)

This addresses 5 high-severity CodeQL security vulnerabilities:
- Missing rate limiting on OIDC auth routes
- Missing CSRF middleware protection
- Incomplete URL sanitization in avatar handling

All 1223 tests passing.

* fix: implement CSRF protection with lusca for CodeQL compliance

Add CSRF protection using lusca.csrf (CodeQL's recommended library) to
protect session-based authentication while supporting hybrid auth patterns.

Implementation:
- Pre-check middleware marks exempt requests (test env, Bearer tokens)
- Lusca CSRF middleware applied with exemption flag check
- Session-based requests require valid x-csrf-token header
- Bearer token requests exempt (don't use cookies)
- Test environment exempt for test execution

This addresses CodeQL security alert js/missing-token-validation while
maintaining support for both cookie-based and token-based authentication.

Related: #977 (OIDC/SSO authentication feature)
2026-04-13 12:17:35 +03:00
Chris Veleris
aeacf0a33a Update readme screenshots 2026-03-27 17:10:49 +02:00
Chris Veleris
68e0f592ed Add support sections 2026-02-12 12:20:14 +02:00
Chris
2b4cb0aeb2
Setup infra for reverse proxy (#831) 2026-02-10 20:22:51 +02:00
Konstantin Levinski
e7f23bcff8
Fix link to First Steps in README.md (#805) 2026-01-31 00:34:43 +02:00
Jean Bispo
a02ae8f850
Docs/api swagger (#505)
* fix: error in script beacause env absence

* feat: add swagger json and api docs

* feat: add BearerAuth in Swagger
2025-11-08 21:41:28 +02:00
Chris
bdc6e1e71f
API Access (#495)
* Scaffold API docs

* fixup! Scaffold API docs

* Add versioning

* Scaffold API Access

* fixup! Scaffold API Access

* fixup! fixup! Scaffold API Access

* Remove DEBUG logs, add tests

* fixup! Remove DEBUG logs, add tests

* Add rate limiter

* Only enable swagger in development

* Update docs

* fixup! Update docs

* fixup! fixup! Update docs

* Fix issue with markdown table headers
2025-11-07 15:19:30 +02:00
Chris
010bfb0efd
Conditionally render (#485) 2025-11-04 18:04:22 +02:00
Chris
26a0024207
Add new logos (#463)
* Add new logos

* fixup! Add new logos

* fixup! fixup! Add new logos

* Setup login screen

* fixup! Setup login screen
2025-11-02 00:18:40 +02:00
Chris Veleris
7e86c00ccd Update README 2025-11-01 07:46:39 +02:00
crypt0rr
f8fa1db378 Fix broken links + Resolve Markdown issues 2025-10-29 15:17:46 +02:00
Chris Veleris
48d2eca4e3 Update website 2025-10-28 08:14:08 +02:00
Chris Veleris
3aa96185d0 Move instructions to docs 2025-10-28 08:04:38 +02:00
Chris Veleris
8e0fae675c Update readme and website 2025-10-20 00:05:54 +03:00
Chris Veleris
0f95605162 Update README 2025-07-24 17:33:01 +03:00
Chris Veleris
8f7f90aa5c Update README 2025-07-24 17:29:06 +03:00
antanst
9e5c084eae Document new env vars in README 2025-07-24 16:27:09 +03:00
antanst
8c2435c952 Disable internal SSL
Users should use a TLS terminator if necessary.
2025-07-23 12:22:27 +03:00
Chris Veleris
922a12c85e Change icon 2025-07-23 12:22:06 +03:00
Chris Veleris
e82e323c16 Fix infinite loops and change shortcuts 2025-07-21 23:15:39 +03:00
Stephen Curran
9a884525aa
Update README.md -- fix the Philosophy Link (#183)
Corrects the link from "example.com" to the (I think) correct link on Medium.

Signed-off-by: Stephen Curran <swcurran@gmail.com>
2025-07-20 14:08:12 +03:00
Antonis Anastasiadis
dad0bd45ff
Facilitate custom UID/GID at runtime in Docker. (#161)
* Cleanup /scripts dir

* Facilitate custom UID/GID at Docker runtime.

Changes file permissions at runtime depending on UID/GID.

* Disable non-functional frontend tests for now.

---------

Co-authored-by: antanst <>
2025-07-15 21:25:06 +03:00
Antonis Anastasiadis
c7c859f666
Merge package.json files into one (#160)
Co-authored-by: Chris Veleris <chrisveleris@gmail.com>
2025-07-15 10:45:29 +03:00
Chris Veleris
723a6cc562 Landing page improvement 2025-07-15 10:44:02 +03:00
Chris Veleris
8e7f25b3a6 Add multilanguage support 2025-07-15 10:44:01 +03:00
Chris Veleris
89439b67db Improve blank slate and add favicon, translation 2025-07-10 17:34:09 +03:00
Chris Veleris
c39c0ec241 Update README 2025-07-07 14:28:47 +03:00
Chris Veleris
378f8c269b Add community links 2025-07-05 08:00:00 +03:00
Chris Veleris
22ca177836 Improve Telegram integration setup docs 2025-07-04 21:23:07 +03:00
Chris Veleris
f9eba248d5 Improve taskmodal layout 2025-07-04 18:14:43 +03:00
Chris Veleris
0f882adef2 Update readme discord links 2025-07-02 17:38:20 +03:00
Chris Veleris
d68fa0a7e9 Update README and index page 2025-07-01 16:31:31 +03:00
Chris Veleris
2cb27d6367 Update README 2025-07-01 16:00:48 +03:00
Chris Veleris
b3ff4bcd1f Update README 2025-06-27 20:05:58 +03:00
Chris
f3610137f0
Scaffold recurring task layout (#83)
* Scaffold recurring task layout

* Cleanup
2025-06-19 16:56:38 +03:00
Chris Veleris
613423e485 Update github pages landing page 2025-06-17 12:07:53 +03:00
Chris
3c1209a5a9
Express migration (#80)
* Initial migration

* Cleanup and create migration scripts

* Introduce test suite

* Fix test issues

* Correct CORS issue and update paths

* Update README
2025-06-16 21:50:44 +03:00
Chris Veleris
7a5fe2b11c Add other projects section 2025-06-13 23:56:58 +03:00
Chris
5c427ef314
I18n (#67) 2025-06-09 07:30:00 +03:00
Chris Veleris
f91efd5f1f Update README and screenshots 2024-11-11 11:39:31 +02:00
Chris Veleris
f105f36fa1 Update README 2024-11-11 10:52:28 +02:00
Chris Veleris
c74cbea888 Add done tasks to projects 2024-11-08 21:17:00 +02:00
Chris Veleris
03016e9e6a Update README 2024-11-05 18:04:11 +02:00
Chris Veleris
dfcb97a355 Move to React
Add .gitignore

Removed node_modules from previous commit

Fix task modes

Fix task modes

Fix task modes

Remove node_modules

Update basic task modal

Add notes functionality

Improve UI

Setup views

Add scopes

Fix projects layout

Restructure

Fix rest of the UI issues

Cleanup old views

Add .env to .gitignore
2024-10-25 21:03:43 +03:00
Chris Veleris
d06e124e5b Fix an issue with SSL and env variable 2024-09-16 23:54:02 +03:00
Chris Veleris
2fe6968e3b Update version v0.19 2024-09-13 11:34:18 +03:00
Chris Veleris
238e690cd3 Update README 2024-09-13 11:26:30 +03:00
Chris Veleris
ff113cfe48 Update tag version 2024-03-03 13:51:27 +02:00
Chris Veleris
e724b586c2 Update readme 2023-12-05 18:32:01 +02:00
Chris Veleris
f083d355e8 Fix due_date ordering issue 2023-11-29 19:04:01 +02:00