Incorrect accepted_statuscodes via API (using python uptime-kuma-api package) made kuma completely non-functional #2437

Closed
opened 2026-02-28 02:54:44 -05:00 by deekerman · 1 comment
Owner

Originally created by @mgaller on GitHub (Aug 3, 2023).

⚠️ Please verify that this bug has NOT been raised before.

  • I checked and didn't find similar issue

🛡️ Security Policy

Description

Passing incorrect input [200] to accepted_statuscodes via the python api package made kuma completely non-functional.
The backend should do atleast some validation on fields, before saving monitors.

👟 Reproduction steps

Create a Monitor via the Python API using "uptime-kuma-api"

api = UptimeKumaApi(f'https://kuma.example.com')
api.login('root', '1234')
monitor = api.add_monitor(
    type=MonitorType.HTTP,
    name=f'Customer: xy',
    url='https://something.example.com',
    interval=60 * 5,
    maxretries=3,
    accepted_statuscodes=[200],
)

👀 Expected behavior

Throwing some sort of error and not saving the incorrect monitor.

😓 Actual Behavior

Server crashes directly and on every startup, can not reach Backend or use the API.

🐻 Uptime-Kuma Version

1.22.1 with docker alpine

💻 Operating System and Arch

Ubuntu 22.04.2 LTS

🌐 Browser

Firefox 115

🐋 Docker Version

Docker version 24.0.5

🟩 NodeJS Version

16

📝 Relevant log output

2023-08-03T07:47:03+02:00 [MONITOR] INFO: Added Monitor: undefined User ID: 1
/app/server/util-server.js:585
        const codeRangeSplit = codeRange.split("-").map(string => parseInt(string));
                                         ^

TypeError: codeRange.split is not a function
    at exports.checkStatusCode (/app/server/util-server.js:585:42)
    at validateStatus (/app/server/model/monitor.js:356:36)
    at settle (/app/node_modules/axios/lib/core/settle.js:14:46)
    at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:347:11)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
==> Performing startup jobs and maintenance tasks
==> Starting application with user 0 group 0
Welcome to Uptime Kuma
Your Node.js version: 16
2023-08-03T05:47:03Z [SERVER] INFO: Welcome to Uptime Kuma
2023-08-03T05:47:03Z [SERVER] INFO: Node Env: production
2023-08-03T05:47:03Z [SERVER] INFO: Importing Node libraries
2023-08-03T05:47:03Z [SERVER] INFO: Importing 3rd-party libraries
2023-08-03T05:47:05Z [SERVER] INFO: Creating express and socket.io instance
2023-08-03T05:47:05Z [SERVER] INFO: Server Type: HTTP
2023-08-03T05:47:05Z [SERVER] INFO: Importing this project modules
2023-08-03T05:47:05Z [NOTIFICATION] INFO: Prepare Notification Providers
2023-08-03T05:47:05Z [SERVER] INFO: Version: 1.22.1
2023-08-03T05:47:05Z [DB] INFO: Data Dir: ./data/
2023-08-03T05:47:05Z [SERVER] INFO: Connecting to the Database
2023-08-03T05:47:05Z [DB] INFO: SQLite config:
[ { journal_mode: 'wal' } ]
[ { cache_size: -12000 } ]
2023-08-03T05:47:05Z [DB] INFO: SQLite Version: 3.41.1
2023-08-03T05:47:05Z [SERVER] INFO: Connected
2023-08-03T05:47:05Z [DB] INFO: Your database version: 10
2023-08-03T05:47:05Z [DB] INFO: Latest database version: 10
2023-08-03T05:47:05Z [DB] INFO: Database patch not needed
2023-08-03T05:47:05Z [DB] INFO: Database Patch 2.0 Process
2023-08-03T05:47:05Z [SERVER] INFO: Load JWT secret from database.
2023-08-03T07:47:05+02:00 [SERVER] INFO: Adding route
2023-08-03T07:47:05+02:00 [SERVER] INFO: Adding socket handler
2023-08-03T07:47:05+02:00 [SERVER] INFO: Init the server
2023-08-03T07:47:05+02:00 [SERVER] INFO: Listening on 3001
/app/server/util-server.js:585
        const codeRangeSplit = codeRange.split("-").map(string => parseInt(string));
                                         ^

TypeError: codeRange.split is not a function
    at exports.checkStatusCode (/app/server/util-server.js:585:42)
    at validateStatus (/app/server/model/monitor.js:356:36)
    at settle (/app/node_modules/axios/lib/core/settle.js:14:46)
    at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:347:11)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Originally created by @mgaller on GitHub (Aug 3, 2023). ### ⚠️ Please verify that this bug has NOT been raised before. - [X] I checked and didn't find similar issue ### 🛡️ Security Policy - [X] I agree to have read this project [Security Policy](https://github.com/louislam/uptime-kuma/security/policy) ### Description Passing incorrect input [200] to accepted_statuscodes via the python api package made kuma completely non-functional. The backend should do atleast some validation on fields, before saving monitors. ### 👟 Reproduction steps Create a Monitor via the Python API using "uptime-kuma-api" ``` api = UptimeKumaApi(f'https://kuma.example.com') api.login('root', '1234') monitor = api.add_monitor( type=MonitorType.HTTP, name=f'Customer: xy', url='https://something.example.com', interval=60 * 5, maxretries=3, accepted_statuscodes=[200], ) ``` ### 👀 Expected behavior Throwing some sort of error and not saving the incorrect monitor. ### 😓 Actual Behavior Server crashes directly and on every startup, can not reach Backend or use the API. ### 🐻 Uptime-Kuma Version 1.22.1 with docker alpine ### 💻 Operating System and Arch Ubuntu 22.04.2 LTS ### 🌐 Browser Firefox 115 ### 🐋 Docker Version Docker version 24.0.5 ### 🟩 NodeJS Version 16 ### 📝 Relevant log output ```shell 2023-08-03T07:47:03+02:00 [MONITOR] INFO: Added Monitor: undefined User ID: 1 /app/server/util-server.js:585 const codeRangeSplit = codeRange.split("-").map(string => parseInt(string)); ^ TypeError: codeRange.split is not a function at exports.checkStatusCode (/app/server/util-server.js:585:42) at validateStatus (/app/server/model/monitor.js:356:36) at settle (/app/node_modules/axios/lib/core/settle.js:14:46) at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:347:11) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) ==> Performing startup jobs and maintenance tasks ==> Starting application with user 0 group 0 Welcome to Uptime Kuma Your Node.js version: 16 2023-08-03T05:47:03Z [SERVER] INFO: Welcome to Uptime Kuma 2023-08-03T05:47:03Z [SERVER] INFO: Node Env: production 2023-08-03T05:47:03Z [SERVER] INFO: Importing Node libraries 2023-08-03T05:47:03Z [SERVER] INFO: Importing 3rd-party libraries 2023-08-03T05:47:05Z [SERVER] INFO: Creating express and socket.io instance 2023-08-03T05:47:05Z [SERVER] INFO: Server Type: HTTP 2023-08-03T05:47:05Z [SERVER] INFO: Importing this project modules 2023-08-03T05:47:05Z [NOTIFICATION] INFO: Prepare Notification Providers 2023-08-03T05:47:05Z [SERVER] INFO: Version: 1.22.1 2023-08-03T05:47:05Z [DB] INFO: Data Dir: ./data/ 2023-08-03T05:47:05Z [SERVER] INFO: Connecting to the Database 2023-08-03T05:47:05Z [DB] INFO: SQLite config: [ { journal_mode: 'wal' } ] [ { cache_size: -12000 } ] 2023-08-03T05:47:05Z [DB] INFO: SQLite Version: 3.41.1 2023-08-03T05:47:05Z [SERVER] INFO: Connected 2023-08-03T05:47:05Z [DB] INFO: Your database version: 10 2023-08-03T05:47:05Z [DB] INFO: Latest database version: 10 2023-08-03T05:47:05Z [DB] INFO: Database patch not needed 2023-08-03T05:47:05Z [DB] INFO: Database Patch 2.0 Process 2023-08-03T05:47:05Z [SERVER] INFO: Load JWT secret from database. 2023-08-03T07:47:05+02:00 [SERVER] INFO: Adding route 2023-08-03T07:47:05+02:00 [SERVER] INFO: Adding socket handler 2023-08-03T07:47:05+02:00 [SERVER] INFO: Init the server 2023-08-03T07:47:05+02:00 [SERVER] INFO: Listening on 3001 /app/server/util-server.js:585 const codeRangeSplit = codeRange.split("-").map(string => parseInt(string)); ^ TypeError: codeRange.split is not a function at exports.checkStatusCode (/app/server/util-server.js:585:42) at validateStatus (/app/server/model/monitor.js:356:36) at settle (/app/node_modules/axios/lib/core/settle.js:14:46) at IncomingMessage.handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:347:11) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21) ```
deekerman 2026-02-28 02:54:44 -05:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@CommanderStorm commented on GitHub (Aug 3, 2023):

We don't have an api, nor do we maintain the package you are using.
See #118 for further information.

Please raise the issue here https://github.com/lucasheld/uptime-kuma-api

@CommanderStorm commented on GitHub (Aug 3, 2023): We don't have an api, nor do we maintain the package you are using. See #118 for further information. Please raise the issue here https://github.com/lucasheld/uptime-kuma-api
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/uptime-kuma#2437
No description provided.