[Bug]: Missing validation on limit parameter in libraries/id/items #2278

Closed
opened 2026-04-25 00:05:43 +02:00 by adam · 1 comment
Owner

Originally created by @Sapd on GitHub (Sep 26, 2024).

What happened?

A user can crash ABS when it it uses the items API and uses a non-integer limit:

/api/libraries/${libraryId}/items?limit=${limit}

crashes for example when limit is 6.5

What did you expect to happen?

It should return 400 bad request instead of crashing

Steps to reproduce the issue

See above

Audiobookshelf version

v2.13.4

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

[2024-09-26 10:31:25.191] FATAL: [Server] Unhandled rejection: SequelizeDatabaseError: SQLITE_MISMATCH: datatype mismatch, promise: Promise {
  <rejected> Error
      at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27)
      at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50
      at new Promise (<anonymous>)
      at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12)
      at /node_modules/sequelize/lib/sequelize.js:315:28
      at async SQLiteQueryInterface.select (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12)
      at async book.findAll (/node_modules/sequelize/lib/model.js:1140:21)
      at async Promise.all (index 1)
      at async book.findAndCountAll (/node_modules/sequelize/lib/model.js:1322:27)
      at async Object.getFilteredLibraryItems (/server/utils/queries/libraryItemsBookFilters.js:558:36) {
    name: 'SequelizeDatabaseError',
    parent: [Error: SQLITE_MISMATCH: datatype mismatch] {
      errno: 20,
      code: 'SQLITE_MISMATCH',
...[query cut]...

Additional Notes

No response

Originally created by @Sapd on GitHub (Sep 26, 2024). ### What happened? A user can crash ABS when it it uses the items API and uses a non-integer limit: ``` /api/libraries/${libraryId}/items?limit=${limit} ``` crashes for example when limit is `6.5` ### What did you expect to happen? It should return 400 bad request instead of crashing ### Steps to reproduce the issue See above ### Audiobookshelf version v2.13.4 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell [2024-09-26 10:31:25.191] FATAL: [Server] Unhandled rejection: SequelizeDatabaseError: SQLITE_MISMATCH: datatype mismatch, promise: Promise { <rejected> Error at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27) at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50 at new Promise (<anonymous>) at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12) at /node_modules/sequelize/lib/sequelize.js:315:28 at async SQLiteQueryInterface.select (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12) at async book.findAll (/node_modules/sequelize/lib/model.js:1140:21) at async Promise.all (index 1) at async book.findAndCountAll (/node_modules/sequelize/lib/model.js:1322:27) at async Object.getFilteredLibraryItems (/server/utils/queries/libraryItemsBookFilters.js:558:36) { name: 'SequelizeDatabaseError', parent: [Error: SQLITE_MISMATCH: datatype mismatch] { errno: 20, code: 'SQLITE_MISMATCH', ...[query cut]... ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:05:43 +02:00
adam closed this issue 2026-04-25 00:05:43 +02:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 5, 2024):

Fixed in v2.14.0.

@github-actions[bot] commented on GitHub (Oct 5, 2024): Fixed in [v2.14.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.14.0).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2278