Commit Graph

52 Commits

Author SHA1 Message Date
Aditya Tripathi e7e65831a7 fix(livewire): preserve wire:dirty across DB status broadcasts
The earlier refreshStatus fix kept user-typed values intact but Livewire still
absorbed deferred wire:model values into the snapshot on every broadcast-
triggered roundtrip, clearing the unsaved-changes indicator and making the form
look auto-saved. Move all status-derived display (DB URLs, SSL toggle/mode,
cert expiry) out of each DB General form into a sibling StatusInfo Livewire
component, so the form never roundtrips on broadcasts.

Shared scaffolding lives in App\Traits\HasDatabaseStatusInfo plus an x-database-
status-info Blade component, leaving each per-DB StatusInfo class as a ~20-50
line declaration of label, SSL mode options, and SSL save hooks. Parents
dispatch databaseUpdated from save methods so the sibling refreshes after writes.

Tests cover the architecture (no DB form subscribes to status broadcasts) and
the sibling's refresh-on-status-change behavior.
2026-05-21 08:31:08 +00:00
Aditya Tripathi b9f773c1d9 fix(livewire): stop broadcast handlers from wiping in-progress form input 2026-05-20 19:04:43 +00:00
Andras Bacsai a05d4e3a4b fix(database): tighten Postgres init script filename handling
Validate new init-script filenames against path traversal and shell
metacharacters via a new validateFilenameSafe() helper, and harden the
write/delete paths with basename() + escapeshellarg() so legacy rows
still deploy and can be cleaned up without regressions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 21:26:34 +02:00
Andras Bacsai 40a9881ef2 fix(database): skip credential pattern validation for unchanged values
Pattern enforcement now conditional on field being dirty (changed vs
saved value). Prevents false validation failures when existing records
hold legacy credential formats that pre-date the stricter regex rules.
2026-04-20 13:58:44 +02:00
Andras Bacsai 03313e54cc fix(database): enforce credential format validation and sanitize init/SSL arguments
Add ValidationPatterns helpers for database identifiers and passwords,
apply them across database Livewire components and the API controller,
encode MongoDB init script values via json_encode, and pass the MySQL
user through escapeshellarg when generating SSL chown commands.
2026-04-20 13:58:36 +02:00
Andras Bacsai 2692496726 fix(database): refresh SSL/status state and harden clone writes
Handle database status updates more reliably by listening for `ServiceChecked`
and using explicit `refresh()` handlers in Livewire database components.

Also switch guarded clone/create paths to `forceFill`/`forceCreate` in helper
flows to avoid missing persisted attributes during app/service cloning.

Update log/terminal font stacks to Geist (with bundled variable fonts) and add
coverage for SSL status refresh, persistent volume UUID cloning, and log font
styling.
2026-03-31 09:29:36 +02:00
Andras Bacsai 3b96215226 fix(validation): add input validation for port exposes and port mappings fields (#9240) 2026-03-30 21:02:50 +02:00
Andras Bacsai 9a0087ff69 fix(validation): add input validation for database public port and proxy timeout (#9272) 2026-03-30 15:10:26 +02:00
Andras Bacsai 850c37bedd fix(database): auto-generate missing CA cert on SSL regeneration
Prevent null CA certificate access during database SSL certificate regeneration
across KeyDB, MariaDB, MongoDB, MySQL, PostgreSQL, and Redis components.

If no CA certificate exists, attempt to generate one and re-query; if still
missing, dispatch a clear error and stop regeneration gracefully.

Add `SslCertificateRegenerationTest` coverage for missing-CA and CA-query
scenarios to prevent regressions.
2026-03-30 13:10:49 +02:00
ShadowArcanist c9f20ba2a2 fix(validation): add input validation for database public port and proxy timeout 2026-03-29 19:11:28 +05:30
ShadowArcanist 105b4a9267 fix(validation): add input validation for port exposes and port mappings fields 2026-03-28 23:23:25 +05:30
Brendan G. Lim 040658c142 fix: address review feedback on proxy timeout
- Fix disable logic: timeout editable when proxy is stopped
- Remove hardcoded proxy_connect_timeout (60s is nginx default)
- Remove misleading '0 for no timeout' helper text
- Add min:1 validation for timeout value
2026-02-27 14:24:04 -08:00
Brendan G. Lim 30c1d9bbd0 feat: add configurable timeout for public database TCP proxy
Adds a per-database 'Proxy Timeout' setting for publicly exposed databases.
The nginx stream proxy_timeout can now be configured in the UI, defaulting
to 3600s (1 hour) instead of nginx's 10min default. Set to 0 for no timeout.

Fixes #7743
2026-02-26 21:12:58 -08:00
🏔️ Peak caca421e2e fix: db public port instant save and simplify if condition (#7883) 2026-01-06 13:44:46 +01:00
peaklabs-dev e774921866 refactor: remove duplicated validation messages 2026-01-05 13:15:14 +01:00
Andras Bacsai 0073d045fb fix: enhance security by validating and escaping database names, file paths, and proxy configuration filenames to prevent command injection 2025-11-27 14:36:31 +01:00
Andras Bacsai e20327b9c4 fix: add authorization checks to database Livewire components
Added authorization checks to 11 database-related Livewire components
that were loading sensitive database configuration without verifying
user permissions.

Changes:
- Added authorize('view', $database) to all 8 database type General.php mount() methods
- Added authorization to Configuration.php before loading database
- Added authorization to BackupEdit.php before loading backup config
- Added authorization to Import.php before loading database resource

This prevents unauthorized users from accessing database credentials,
connection strings, and configuration details.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 17:33:42 +02:00
Andras Bacsai 74c70b431c fix: prevent TypeError in database General components with null server
Nullable server + guard to avoid TypeError/NPE. Don't terminate the app, terminate the bug.

Changes:
- Made Server property nullable (?Server $server = null) in all 8 database General components
- Added guard clause in mount() to check for null server before accessing it
- Displays user-friendly error message when destination server is not configured
- Prevents crashes in methods like isLogDrainEnabled() and sslCertificates()

Fixed components:
- Mariadb, Dragonfly, Clickhouse, Keydb
- Mysql, Mongodb, Redis, Postgresql

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 17:04:48 +02:00
Andras Bacsai a15ab54495 refactor: migrate database components from legacy model binding to explicit properties
- Remove global 'refresh' event listeners from all database General components
- Migrate Redis, MySQL, MariaDB, MongoDB, PostgreSQL, and KeyDB components to use explicit public properties instead of wire:model="database.field"
- Implement syncData() method in each component for manual data synchronization between properties and Eloquent models
- Update all validation rules, messages, and attributes to reference new property names
- Update Blade views to bind inputs to explicit properties (e.g., id="name" instead of id="database.name")
- Prepare codebase for disabling Livewire's legacy_model_binding configuration option

This refactoring resolves form field reset issues caused by global refresh events
and follows Livewire 3 best practices for component property management.
2025-10-13 10:01:17 +02:00
Andras Bacsai f4e5c195fe refactor: replace direct SslCertificate queries with server relationship methods for consistency 2025-10-09 17:00:05 +02:00
Andras Bacsai adb8f9d88e feat(auth): implement authorization checks for database management 2025-08-23 18:50:35 +02:00
Andras Bacsai 5c4a265542 refactor(validation): implement centralized validation patterns across components
- Introduced `ValidationPatterns` class to standardize validation rules and messages for various fields across multiple components.
- Updated components including `General`, `StackForm`, `Create`, and `Show` to utilize the new validation patterns, ensuring consistent validation logic.
- Enhanced error messages for required fields and added regex validation for names and descriptions to improve user feedback.
- Adjusted styling in the `create.blade.php` view for better visual hierarchy.
2025-08-19 14:15:31 +02:00
Andras Bacsai 365bf3cbf0 fix(dev): mount points?! 2025-05-03 09:59:42 +02:00
Andras Bacsai 3be6be4c1b refactor(database): require PEM key file for SSL certificate regeneration 2025-03-27 10:02:25 +01:00
Andras Bacsai 1857a54d92 refactor(database): update import statements for Auth in database components 2025-03-26 18:31:42 +01:00
Andras Bacsai d7ded7f8e5 refactor(database): enhance SSL configuration handling for various databases 2025-03-26 17:24:46 +01:00
Andras Bacsai 950acffe0b refactor(database): streamline SSL configuration handling across database types 2025-03-17 15:15:54 +01:00
peaklabs-dev 225f24e650 chore: improve code quality suggested by code rabbit 2025-02-19 18:04:58 +01:00
peaklabs-dev 62fb2c2877 fix(ssl): ger caCert and mountPath correctly 2025-02-07 18:30:07 +01:00
peaklabs-dev 951a454cbc fix(ssl): regenerating certs for a specific DB
- fix: add mount path to make file mounts work correctly
- fix: get CA cert of the server not some random cert
2025-02-05 21:22:54 +01:00
peaklabs-dev 3c62130e86 fix(ssl): improve SSL cert file mounts
- If SSL is disabled, delete the SSL crt and file mounts in the DB
- If SSL is disabled, delete the SSL folder
- If SSL is enabled, make sure the file mounts are added inside the helper
- remove old file mounts first to make sure the ssl crt content is always up to date and no duplicates are added
2025-02-04 16:34:24 +01:00
peaklabs-dev fd5b7492f8 chore(ui): improve valid until handling 2025-02-03 23:21:09 +01:00
peaklabs-dev 53510928d2 feat(ssl): regenerate certificate and valid until UI 2025-02-03 22:54:31 +01:00
peaklabs-dev 875d1d49bb feat(ui): Add ssl settings to Postgres ui 2025-01-29 13:25:05 +01:00
Andras Bacsai 1fe4dd722b Revert "rector: arrrrr"
This reverts commit 16c0cd10d8.
2025-01-07 15:31:43 +01:00
Andras Bacsai 16c0cd10d8 rector: arrrrr 2025-01-07 14:52:08 +01:00
peaklabs-dev 159c4aa7ac remove old init script on server if it is renamed 2024-10-18 21:08:45 +02:00
peaklabs-dev 7f393eb2c2 fix indexing after deletion and make sure init script is removed form the server 2024-10-18 20:51:51 +02:00
peaklabs-dev 907c6cc4e5 format 2024-10-18 16:16:06 +02:00
peaklabs-dev 2dcfdcab3b fix init scripts for postgres 2024-10-18 16:09:21 +02:00
Andras Bacsai f106e6e37b feat: add custom docker container options to all databases 2024-08-16 13:56:47 +02:00
Andras Bacsai 3c13f1ff61 feat: restart database
feat: public dbs stay public after restart
feat: patch database conf
2024-07-02 13:39:44 +02:00
Andras Bacsai c39d6dd407 feat: token permissions
feat: handle sensitive data
feat: handle read-only data
2024-07-02 12:15:58 +02:00
andrasbacsai f10f3456d7 Fix styling 2024-06-14 12:10:40 +00:00
Andras Bacsai b17be37aee fix: db proxy status shown better in the UI 2024-06-14 14:09:56 +02:00
Thijmen d86274cc37 Fix styling 2024-06-10 20:43:34 +00:00
Andras Bacsai 4667f96b40 feat: db proxy logs 2024-06-09 21:33:17 +02:00
Andras Bacsai 7a32b8d1d2 feat: configuration checker for all resources 2024-04-12 12:44:49 +02:00
Andras Bacsai c20aa0b256 Refactor method names to use camel case 2024-03-04 11:01:14 +01:00
Andras Bacsai 8385bbb0a0 feat: gzip enabled & stipprefix setting
refactor: code
2024-03-04 10:46:13 +01:00