feat: database checks (PostgreSQL, MySQL/MariaDB, SQL Server, MongoDB, Redis) #100

Merged
Sebi merged 3 commits from feat/db-checks into main 2026-11-22 17:42:55 +00:00
Owner

Stacked on #99.

Checks (internal/check/db.go): target host:port; user, password, database, TLS (require = encrypted without verification, verify, disable); SQL types run a query (default SELECT 1) and can compare the first value (expect); MongoDB and Redis ping (Redis: ACL user, database 0–15). All connections through the network guard (MySQL via registered dial functions, SQL Server via connector dialer, MongoDB/Redis/pgx via dialers). Errors never repeat the password.

Secret monitor settings (monitorsecrets.go): check.SecretFields marks them; stored as sealed_<field> (AES-GCM, bound to type and field), stripped from API responses, console and GDPR export (secrets_set names what is set), kept when an edit leaves them empty, opened only when building a checker's job.

Schema: monitor type constraint is now a format check (00035); the check package validates types and settings, so new types need no migration.

Tests: each database against a real server (good and wrong credentials, password not in errors, private addresses refused without permission); API flow with a real checker signing in with the sealed password. Compose profile checks (MariaDB, MongoDB, SQL Server); CI runs MariaDB and MongoDB as services, SQL Server only locally (image too large for ephemeral runners).

Closes #93

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

Stacked on #99. **Checks** (`internal/check/db.go`): target `host:port`; user, password, database, TLS (`require` = encrypted without verification, `verify`, `disable`); SQL types run a query (default `SELECT 1`) and can compare the first value (`expect`); MongoDB and Redis ping (Redis: ACL user, database 0–15). All connections through the network guard (MySQL via registered dial functions, SQL Server via connector dialer, MongoDB/Redis/pgx via dialers). Errors never repeat the password. **Secret monitor settings** (`monitorsecrets.go`): `check.SecretFields` marks them; stored as `sealed_<field>` (AES-GCM, bound to type and field), stripped from API responses, console and GDPR export (`secrets_set` names what is set), kept when an edit leaves them empty, opened only when building a checker's job. **Schema:** monitor type constraint is now a format check (`00035`); the check package validates types and settings, so new types need no migration. **Tests:** each database against a real server (good and wrong credentials, password not in errors, private addresses refused without permission); API flow with a real checker signing in with the sealed password. Compose profile `checks` (MariaDB, MongoDB, SQL Server); CI runs MariaDB and MongoDB as services, SQL Server only locally (image too large for ephemeral runners). Closes #93 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added this to the M11 Uptime Kuma parity milestone 2026-11-22 15:17:22 +00:00
Sebi changed target branch from feat/notification-providers to main 2026-11-22 17:42:28 +00:00
Sebi added 3 commits 2026-11-22 17:42:28 +00:00
Each connects to host:port with the configured credentials and TLS mode,
signs in and runs a query (a ping for MongoDB and Redis), optionally
comparing the first value. Connections go through the network guard, and
errors never repeat the password. Tested against real servers.

Refs #93

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
feat: database monitors with sealed credentials
ci / image (pull_request) Successful in 2m38s
ci / build (pull_request) Successful in 7m5s
ci / lint (pull_request) Successful in 10m15s
ci / test (pull_request) Failing after 11m53s
d3cf9f48e1
Secret monitor settings such as database passwords are stored sealed,
bound to monitor type and field, never returned by the API, the console
or exports, kept when an edit leaves them empty, and opened only for the
checker's job. Monitor types are validated by the check package; the
database only checks their format. Compose gets a checks profile with
MariaDB, MongoDB and SQL Server, and CI tests against MariaDB and
MongoDB.

Closes #93

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
test(check): skip only the database checks whose server is missing
ci / build (pull_request) Successful in 10m12s
ci / test (pull_request) Successful in 9m54s
ci / image (pull_request) Successful in 2m35s
ci / lint (pull_request) Successful in 10m58s
5a644e4ae5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi merged commit 74dde09689 into main 2026-11-22 17:42:55 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#100