Commit graph

92 commits

Author SHA1 Message Date
Denis Arnst
a6848065e1
OIDC: Skip nonce for mobile flow to fix app login
Some IdPs (e.g. Authentik) don't echo the nonce in the id_token for
the authorization code flow, causing "nonce mismatch, got: undefined"
errors when the mobile app attempts SSO login. The mobile flow already
uses PKCE which provides equivalent replay protection, so nonce is not
needed. Web flow continues to use nonce for defense-in-depth.
2026-02-13 12:35:03 +01:00
Denis Arnst
67f8eb6815
OIDC: Support object-shaped and string group claims
The group claim was assumed to always be an array, which crashes with
providers like Zitadel that return an object with role names as keys
(e.g. { "admin": {...}, "user": {...} }). Normalize all common formats:
array, single string, and object (extract keys).

Fixes #4744
2026-02-12 13:25:56 +01:00
Denis Arnst
e428ba5657
OIDC: Fix CodeQL warnings 2026-02-05 20:31:07 +01:00
Denis Arnst
49aeb2da19
Require email_verified to be explicitly true when enforcement is enabled
Previously the check only rejected email_verified === false, allowing
logins when the claim was missing entirely. Since the admin opted in,
the IdP is expected to provide the claim.
2026-02-05 19:56:58 +01:00
Denis Arnst
d5047978a8
Add unit tests for OIDC callback flow and authorization
Test handleCallback (11), getAuthorizationUrl (13), generatePkce (5),
handleMobileRedirect (5), cleanupStaleAuthSessions (3). 88 total.
2026-02-05 19:35:50 +01:00
Denis Arnst
ed0db539c9
Add unit tests for 5 OidcAuthStrategy methods
Cover validateGroupClaim, isValidRedirectUri, isValidWebCallbackUrl,
updateUserPermissions, and verifyUser with 40 new tests (51 total).

Tests cover open redirect prevention, group claim validation,
auto-registration flows, permission updates, and error handling.
2026-02-05 18:04:14 +01:00
Denis Arnst
073eff74ef
Add OIDC Back-Channel Logout support
Implement OIDC Back-Channel Logout 1.0 (RFC). When enabled, the IdP can
POST a signed logout_token JWT to invalidate user sessions server-side.

- Add BackchannelLogoutHandler: JWT verification via jose, jti replay
  protection with bounded cache, session destruction by sub or sid
- Add oidcSessionId column to sessions table with index for fast lookups
- Add backchannel logout route (POST /auth/openid/backchannel-logout)
- Notify connected clients via socket to redirect to login page
- Add authOpenIDBackchannelLogoutEnabled toggle in schema-driven settings UI
- Migration v2.34.0 adds oidcSessionId column and index
- Polish settings UI: auto-populate loading state, subfolder dropdown
  options, KeyValueEditor fixes, localized descriptions via descriptionKey,
  duplicate key detection, success/error toasts
- Localize backchannel logout toast (ToastSessionEndedByProvider)
- OidcAuthStrategy tests now use real class via require-cache stubbing
2026-02-05 17:55:10 +01:00
Denis Arnst
33bee70a12
Revamp OIDC auth: remove Passport wrapper, add schema-driven settings UI
- Remove Passport.js wrapper from OIDC auth, use openid-client directly
- Add schema-driven OIDC settings UI (OidcSettingsSchema.js drives form rendering)
- Add group mapping with KeyValueEditor (explicit mapping or legacy direct name match)
- Add scopes configuration (authOpenIDScopes)
- Add verified email enforcement option (authOpenIDRequireVerifiedEmail)
- Fix group claim validation rejecting URN-style claims (#4744)
- Add auto-discover endpoint for OIDC provider configuration
- Store oidcIdToken in sessions table instead of cookie
- Add AuthError class for structured error handling in auth flows
- Migration v2.33.0 adds oidcIdToken column and new settings fields
2026-02-05 17:54:59 +01:00
mikiher
e9a705587a
Merge branch 'advplyr:master' into audible-confidence-score 2025-07-13 10:13:00 +03:00
advplyr
691f291843 Update LibraryItemController unit test
Some checks are pending
Run Component Tests / Run Component Tests (push) Waiting to run
Integration Test / build and test (push) Waiting to run
Run Unit Tests / Run Unit Tests (push) Waiting to run
2025-07-07 16:26:17 -05:00
mikiher
a894ceb9cf Match confidence calculation for audible results 2025-05-21 10:25:42 +03:00
Nikolaj Schumacher
3cc527484d Fix .ignore file causing ignores outside the directory
The file "a/.ignore" should only cause the directory "a" to be ignored.
However, it also ignores all files starting with "a".
After this fix, it will only ignore paths starting with "a/".
2025-05-04 22:43:44 +02:00
mikiher
40504da4d7
Improve book library page query performance for author sort order (#4080)
* Add migration to create authorNames* columns, in libraryItems including update triggers and indices

* Add authorNames columns and indices to LibraryItem model

* Add database triggers for updating author names in libraryItems (for new databases)

* Populate authorNames during book scanning

* Update book sorting to use new authorNames columns

* Add an index on podcastEpisodes.publishedAt

* Fix group_concat order by and update to sqlite 3.44.2

---------

Co-authored-by: advplyr <advplyr@protonmail.com>
2025-03-17 17:09:49 -05:00
advplyr
804dafdfcb Add test for parseOpfMetadata OPF v3 author 2025-03-14 17:32:32 -05:00
Nicholas Wallace
0a00ebcde1 Fix: flaky 2.15.0 migration test 2025-02-26 21:40:56 -07:00
advplyr
20f812403f Add fileUtils recurseFiles and shouldIgnoreFile tests 2025-02-23 16:53:11 -06:00
mikiher
568bf0254d Change migration version to v2.19.4 2025-02-18 07:57:46 +02:00
mikiher
23a750214f Add migration in preparation for podcast query optimization 2025-02-16 08:35:51 +02:00
mikiher
8ee5646d79 fix stringifySequelizeQuery and add tests 2025-02-15 23:57:27 +02:00
advplyr
9e54b4f7ca
Merge pull request #3952 from mikiher/query-performance
Improve book library page query performance on title, titleIgnorePrefix, and addedAt sort orders.
2025-02-11 15:41:59 -06:00
advplyr
0ccb88904a fix v2.15.0 migration test 2025-02-09 17:40:29 -06:00
mikiher
a13143245b Improve page load queries on title, titleIgnorePrefix, and addedAt sort order 2025-02-08 12:29:23 +02:00
advplyr
5e5a604d03 Fix name parser to not use "last, first" format when not using comma separators. Adds unit tests #3940 2025-02-05 17:25:31 -06:00
advplyr
ac159bea72 Update unit test stub function 2025-01-05 12:12:20 -06:00
advplyr
5cd14108f9 Remove req.oldLibraryItem usage 2025-01-02 15:54:10 -06:00
advplyr
eb853d9f09 Fix LibraryItemController unit test 2025-01-02 15:51:21 -06:00
Greg Lorenzen
4cdc2a8c28
Feat/download via share link (#3666)
* Adds share download endpoint
* Adds Downloadable toggle to share modal

---------

Co-authored-by: advplyr <advplyr@protonmail.com>
2024-12-29 16:52:57 -06:00
advplyr
302b651e7b Fix library item unit test 2024-12-15 12:38:50 -06:00
mikiher
9b8e059efe Remove serverAddress from Feeds and FeedEpisodes URLs 2024-12-07 19:27:37 +02:00
advplyr
5fa0897ad7
Merge pull request #3665 from mikiher/subdirectory-fixes-3
Subdirectory support for OIDC and SocketIO
2024-12-03 17:29:57 -06:00
advplyr
0f1b64b883 Add test for grouping book library items 2024-12-03 17:21:57 -06:00
advplyr
33aa4f1952 Merge master 2024-12-01 13:27:20 -06:00
advplyr
2b5484243b Add LibraryItemController test for delete/batchDelete/updateMedia endpoint functions to correctly remove authors & series with no books 2024-12-01 12:44:21 -06:00
advplyr
4b52f31d58 Update v2.17.3 migration file to first check if constraints need to be updated, add unit test 2024-11-30 15:48:20 -06:00
mikiher
9917f2d358 Change migration to v2.17.4 2024-11-29 09:01:03 +02:00
mikiher
6d8720b404 Subfolder support for OIDC auth 2024-11-29 04:28:50 +02:00
mikiher
50797879d5
Add a REINDEX NOCASE v2.15.1 migration and update v2.15.0 migration (#3533)
* Add REINDEX NOCASE migration and update v2.15.0 migration

* Update v2.15.0 migration test

* Fix typo
2024-10-18 16:10:29 -05:00
advplyr
e58d7db03b
Merge pull request #3417 from nichwall/series_cleanup_2
Add: series migration to be unique
2024-10-12 15:48:04 -05:00
Nicholas Wallace
e6e494a92c Rename for next minor release 2024-10-07 18:52:14 -07:00
mikiher
501dc938e6 Add Nunicode sqlite extension integration 2024-09-29 09:22:39 +03:00
advplyr
5154e31c1c Update migration to v2.14.0 2024-09-24 17:06:00 -05:00
advplyr
c67b5e950e Update MigrationManager.test.js - moved migrations ensureDir to init() 2024-09-24 16:54:13 -05:00
Nicholas Wallace
8b95dd65d9 Fix: test cases checking the wrong bookSeriesId 2024-09-14 15:43:10 -07:00
Nicholas Wallace
691ed88096 Add more logging, clean up typo 2024-09-14 15:34:38 -07:00
Nicholas Wallace
999ada03d1 Fix: missing variables 2024-09-14 14:36:47 -07:00
Nicholas Wallace
fa451f362b Add: tests for one book in duplicate series 2024-09-14 12:11:31 -07:00
Nicholas Wallace
868659a2f1 Add: unique constraint on bookseries table 2024-09-14 11:44:19 -07:00
advplyr
8ae62da138 Update migration unit test name 2024-09-14 10:40:01 -05:00
advplyr
bedba39af9 Merge branch 'master' into series_cleanup_2 2024-09-14 10:11:16 -05:00
mikiher
55164803b0 Fix migrationMeta database version initial value, and move isDatabaseNew logic inside MigrationManager 2024-09-14 08:01:32 +03:00