Commit graph

12872 commits

Author SHA1 Message Date
Andras Bacsai
b81baff4b1 fix: improve logging and add shell escaping for git ls-remote
Two improvements to Git deployment handling:

1. **ApplicationDeploymentJob.php**:
   - Fixed log message to show actual resolved commit SHA (`$this->commit`)
   - Previously showed `$this->application->git_commit_sha` which could be "HEAD"
   - Now displays the actual 40-character commit SHA that will be deployed

2. **Application.php (generateGitLsRemoteCommands)**:
   - Added `escapeshellarg()` for repository URL in 'other' deployment type
   - Prevents shell injection in git ls-remote commands
   - Complements existing shell escaping in `generateGitImportCommands`
   - Ensures consistent security across all Git operations

**Security Impact:**
- All Git commands now use properly escaped repository URLs
- Prevents command injection through malicious repository URLs
- Consistent escaping in both ls-remote and clone operations

**User Experience:**
- Deployment logs now show exact commit SHA being deployed
- More accurate debugging information for deployment issues

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 20:44:35 +02:00
Andras Bacsai
ebfc87753e
Merge branch 'next' into allow-at-sign-in-git-urls 2025-10-14 20:44:10 +02:00
Andras Bacsai
941afa3585
Merge pull request #6872 from coollabsio/andrasbacsai/db-general-auth-check
fix: add authorization checks to database Livewire components
2025-10-14 17:36:21 +02:00
Andras Bacsai
652f523f5b test: improve Git ls-remote parsing tests with uppercase SHA and negative cases
Enhanced test coverage to match production code regex pattern and prevent
false positives by adding comprehensive edge case testing.

**Changes:**

1. **Updated regex pattern to match production code**:
   - Changed from `/([0-9a-f]{40})\s*\t/` to `/\b([0-9a-fA-F]{40})(?=\s*\t)/`
   - Now handles both uppercase and lowercase hex characters (A-F and a-f)
   - Uses word boundary `\b` for more precise matching
   - Uses lookahead `(?=\s*\t)` instead of capturing whitespace

2. **Added uppercase SHA test**:
   - Tests extraction of uppercase commit SHA (196D3DF7...)
   - Normalizes to lowercase using `strtolower()` for comparison
   - Reflects Git's case-insensitive SHA handling

3. **Added negative test cases**:
   - Tests output with no commit SHA present (error messages only)
   - Tests output with tab but invalid SHA format
   - Ensures `null` is returned to prevent false positives

**Test Coverage:**
- 8 total tests (up from 5)
- Covers all positive cases (lowercase, uppercase, warnings, whitespace)
- Covers negative cases (missing SHA, invalid format)
- Regex pattern now exactly matches production code in ApplicationDeploymentJob.php:1908

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 17:34:26 +02: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
f254af0459 security: escape all shell directory paths in Git deployment commands
Ensures all `cd` commands in Git deployment operations use properly escaped
directory paths via `escapeshellarg()` to prevent shell injection vulnerabilities
and handle special characters correctly.

**Changes:**

1. `setGitImportSettings()` method:
   - Added `$escapedBaseDir` variable for consistent path escaping
   - Replaced all 5 instances of `cd {$baseDir}` with `cd {$escapedBaseDir}`
   - Affects: commit checkout, submodules, and LFS operations

2. `generateGitImportCommands()` method (deploy_key type):
   - Replaced 3 instances in pull request handling for GitLab, GitHub/Gitea, Bitbucket

3. `generateGitImportCommands()` method (other type):
   - Replaced 3 instances in pull request handling for GitLab, GitHub/Gitea, Bitbucket

**Security Impact:**
- Prevents shell injection from malicious directory paths
- Fixes parsing issues with special characters (@, ~, spaces)
- Consistent escaping across all deployment types: source, deploy_key, other
- Complements existing URL escaping for comprehensive security

**Testing:**
- All existing unit tests pass (5/5 Git ls-remote parsing tests)
- Code formatted with Laravel Pint

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 17:23:28 +02:00
Andras Bacsai
a3d9ca5c5c
Merge pull request #6870 from coollabsio/fix-nullable-server-guards
fix: prevent TypeError in database General components with null server
2025-10-14 17:13:47 +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
893093fad3
Update app/Jobs/ApplicationDeploymentJob.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-10-14 15:21:38 +02:00
Andras Bacsai
bf00405971 fix(git): handle Git redirects and improve URL parsing for tangled.sh and other Git hosts
Fixes deployment failures when Git repositories redirect (e.g., tangled.sh → tangled.org)
and improves security by adding proper shell escaping for repository URLs.

**Root Cause:**
Git redirect warnings can appear on the same line as ls-remote output with no newline:
`warning: redirecting to https://tangled.org/...196d3df...	refs/heads/master`

The previous parsing logic split by newlines and extracted text before tabs, which
included the entire warning message instead of just the 40-character commit SHA.

**Changes:**

1. **Fixed commit SHA extraction** (ApplicationDeploymentJob.php):
   - Changed from line-based parsing to regex pattern matching
   - Uses `/([0-9a-f]{40})\s*\t/` to find valid 40-char hex commit SHA before tab
   - Handles warnings on same line, separate lines, multiple warnings, and whitespace
   - Added comprehensive Ray debug logs for troubleshooting

2. **Added security fix** (Application.php):
   - Added `escapeshellarg()` for repository URLs in 'other' deployment type
   - Prevents shell injection and fixes parsing issues with special characters like `@`
   - Added Ray debug logs for deployment type tracking

3. **Comprehensive test coverage** (GitLsRemoteParsingTest.php):
   - Tests normal output without warnings
   - Tests redirect warning on separate line
   - Tests redirect warning on same line (actual tangled.sh format)
   - Tests multiple warning lines
   - Tests extra whitespace handling

**Resolves:**
- Linear issue COOLGH-53: Valid git URLs are rejected as being invalid
- GitHub issue #6568: tangled.sh deployments failing
- Handles Git redirects universally for all Git hosting services

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 11:55:17 +02:00
Andras Bacsai
2aef2c383c
Merge pull request #6868 from coollabsio/handle-pr-process-statuses
Handle all ProcessStatus values in PR updates
2025-10-14 11:07:15 +02:00
Andras Bacsai
8408faf897 Handle all ProcessStatus values in ApplicationPullRequestUpdateJob
- Add support for QUEUED, KILLED, and CANCELLED statuses
- Replace if-elseif chain with match expression for better exhaustiveness
- Add appropriate emoji indicators for each status
- Ensure all ProcessStatus enum values are handled

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 11:05:42 +02:00
Andras Bacsai
040e2b4332 fix: enhance run script to remove existing containers before starting 2025-10-14 10:53:27 +02:00
Andras Bacsai
1cdd6fb876
Merge pull request #6867 from coollabsio/fix-service-refresh-issues
fix: prevent duplicate services on image change and enable real-time UI refresh
2025-10-14 10:20:51 +02:00
Andras Bacsai
ff054cfea9
Merge branch 'next' into fix-service-refresh-issues 2025-10-14 10:17:59 +02:00
Andras Bacsai
ce12c94709 fix: prevent duplicate services on image change and enable real-time UI refresh
This commit addresses two critical issues with Docker Compose service management:

## Issue 1: Duplicate Services Created on Image Change
When changing the image in a docker-compose file, the parser was creating new
ServiceApplication/ServiceDatabase records instead of updating existing ones.

**Root Cause**: The parsers used `firstOrCreate()` with `['name', 'image', 'service_id']`,
meaning any image change would create a new record.

**Fix**: Remove `image` from `firstOrCreate()` queries and update it separately after
finding or creating the service record.

**Changes**:
- `bootstrap/helpers/parsers.php` (serviceParser v3): Fixed in presave loop (lines 1188-1203)
  and main parsing loop (lines 1519-1539)
- `bootstrap/helpers/shared.php` (parseDockerComposeFile v2): Fixed null check logic
  (lines 1308-1348)

## Issue 2: UI Not Refreshing After Changes
When compose file or domain was modified, the Configuration component wasn't receiving
events to refresh its data, requiring manual page refresh to see updates.

**Root Cause**: The Configuration component wasn't listening for refresh events dispatched
by child components (StackForm, EditDomain).

**Fix**: Add event listeners and dispatchers to enable real-time UI updates.

**Changes**:
- `app/Livewire/Project/Service/Configuration.php`: Added listeners for `refreshServices`
  and `refresh` events (lines 36-37)
- `app/Livewire/Project/Service/EditDomain.php`: Added `refreshServices` dispatch (line 76)
- Note: `app/Livewire/Project/Service/StackForm.php` already had the dispatch

## Tests Added
- `tests/Unit/ServiceParserImageUpdateTest.php`: 4 tests verifying no duplicates created
- `tests/Unit/ServiceConfigurationRefreshTest.php`: 4 tests verifying event dispatching

All 8 new tests pass, and all existing unit tests continue to pass.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 10:12:36 +02:00
Andras Bacsai
03d4dd5cad
Merge pull request #6866 from coollabsio/conductor/hetzner-affiliation-link
feat: add Hetzner affiliate link to token form
2025-10-14 09:40:30 +02:00
Andras Bacsai
baabbc9fb4
Merge branch 'next' into conductor/hetzner-affiliation-link 2025-10-14 09:29:30 +02:00
Andras Bacsai
b911d2b281 feat: update Hetzner affiliate link text and URL
- Change URL to https://coolify.io/hetzner
- Add detailed explanation about credits (€10 for Coolify, €20 for new users)
- Clarify it's only for new accounts
- Improve text formatting with extra spacing
- Apply consistent messaging across both modal and full-page layouts
2025-10-14 09:28:01 +02:00
Andras Bacsai
d4b9b61cbd feat: add Hetzner affiliate link to token form
- Add affiliate link when users add their first Hetzner token
- Shows in both modal and full-page layouts
- Friendly messaging about supporting Coolify and getting credits
2025-10-14 09:25:10 +02:00
Andras Bacsai
009ac822ab
Merge pull request #6861 from coollabsio/fix-pgadmin-docker-network
fix: enable docker network connection for pgadmin service
2025-10-13 14:17:15 +02:00
Andras Bacsai
473fe6ffa3
Merge branch 'next' into fix-pgadmin-docker-network 2025-10-13 14:16:27 +02:00
Andras Bacsai
777cdc91f0 fix: enable docker network connection for pgadmin service 2025-10-13 14:13:40 +02:00
Andras Bacsai
8d403cc511
Merge pull request #6538 from AmirHosseinKarimi/fix/mattermost-docker-compose
fix(templates): remove mattermost healthcheck command according to lack of shell in new version
2025-10-13 13:40:17 +02:00
Andras Bacsai
fe91c25b14
Merge pull request #6557 from elalemanyo/template/once-campfire
feat(campfire): add template for Once Campfire
2025-10-13 13:39:43 +02:00
Andras Bacsai
0681f4d004
Merge pull request #6559 from halilim/add-service-gramps-web
feat(service): add Gramps Web template
2025-10-13 13:39:08 +02:00
Andras Bacsai
a1dfb31bf2
Merge pull request #6576 from itsneeku/patch-1
chore(service): update convex template and image
2025-10-13 13:38:40 +02:00
Andras Bacsai
7443b266d8
Merge pull request #6589 from htnminh/v4.x
fix(template/filebrowser): correct healthcheck for Filebrowser
2025-10-13 13:38:10 +02:00
Andras Bacsai
e875fed548
Merge pull request #6563 from ShadowArcanist/service/pgadmin
feat(service): add pgAdmin
2025-10-13 13:37:36 +02:00
Andras Bacsai
4092100cce
Merge pull request #6655 from yipfram/service/lobe-ai-chat
feat(templates): added Lobe Chat service
2025-10-13 13:34:18 +02:00
Andras Bacsai
591d495ec2
Merge pull request #6631 from zehjotkah/next
added rybbit service template
2025-10-13 13:33:55 +02:00
Andras Bacsai
70ab263115
Merge pull request #6636 from scanash00/main
fix: Bluesky PDS template
2025-10-13 13:04:21 +02:00
Andras Bacsai
3c3ac8cdad
Merge pull request #6710 from EvanSchleret/v4.x
feat: Add mail environment variables to docmost.yaml
2025-10-13 13:02:36 +02:00
Andras Bacsai
a1fa49eb0d
Merge pull request #6721 from ShadowArcanist/shadow/fix-service-traccar-healthcheck
fix(service): traccar no available server error
2025-10-13 13:02:02 +02:00
Andras Bacsai
cdfc991e2b
Merge pull request #6735 from Blaumaus/swetrix-analytics-service
feat(service): add Swetrix template
2025-10-13 13:01:45 +02:00
Andras Bacsai
f8f4c046a7
Merge pull request #6753 from seefs001/next
feat(template): NewAPI template
2025-10-13 12:53:24 +02:00
Andras Bacsai
42e39081f8
Merge pull request #6778 from mario-neuhold/patch-1
feat (template): use new homarr image
2025-10-13 12:52:58 +02:00
Andras Bacsai
6098a58c9f
Merge pull request #6793 from YaRissi/service/gotify
feat(template): Adding Gotify service
2025-10-13 12:52:05 +02:00
Andras Bacsai
3e5fb4ae63
Merge pull request #6806 from ShadowArcanist/patch-3
chore(service): Added healthcheck to moodle
2025-10-13 12:50:48 +02:00
Andras Bacsai
a1916c965a
Merge pull request #6831 from ShadowArcanist/patch-4
fix(service): added missing resend env for documenso
2025-10-13 12:50:19 +02:00
Andras Bacsai
bb9ddd089a
Merge pull request #6859 from coollabsio/andrasbacsai/fix-livewire-field-reset
refactor: migrate database components from legacy model binding to explicit properties
2025-10-13 10:51:04 +02:00
Andras Bacsai
df77a99fa3
Merge branch 'next' into andrasbacsai/fix-livewire-field-reset 2025-10-13 10:50:56 +02:00
Andras Bacsai
174c212617
Merge pull request #6860 from coollabsio/fix-api-env-vars-fields
fix: allow all environment variable fields in API endpoints
2025-10-13 10:45:35 +02:00
Andras Bacsai
78031b991a fix: allow all environment variable fields in API endpoints
Fixes #6847

The API endpoints for environment variables were rejecting valid fields
like is_buildtime, is_runtime, is_multiline, and is_shown_once with
422 errors, even though the code was using these fields internally.

Changes:
- Added missing fields to $allowedFields in create_env()
- Added missing fields to $allowedFields in update_env_by_uuid()
- Updated allowed fields in create_bulk_envs()
- Added validation rules for is_runtime and is_buildtime

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 10:44:06 +02:00
Andras Bacsai
400746f72a
Merge pull request #6852 from YaRissi/fix/openapi
fix(openapi): missing 422 error code in openapi spec
2025-10-13 10:42:14 +02:00
Andras Bacsai
6879ba87df
Merge branch 'next' into fix/openapi 2025-10-13 10:42:05 +02:00
Andras Bacsai
acc5dbe105
Merge branch 'next' into andrasbacsai/fix-livewire-field-reset 2025-10-13 10:38:02 +02:00
Andras Bacsai
3dfef0b53a
Merge pull request #6858 from coollabsio/andrasbacsai/fix-db-port-mapping-conflict
fix: prevent container name conflict when updating database port mappings
2025-10-13 10:36:15 +02:00
Andras Bacsai
8d280b4aac fix: prevent container name conflict when updating database port mappings
When port mappings are changed in the UI and the database is restarted,
the system now gracefully stops and removes the existing container before
recreating it with the new configuration.

This prevents the "container name already in use" error that occurred when
Docker Compose tried to create a container with the same name but different
port configuration.

Changes:
- Add graceful container stop (10s timeout) before docker compose up
- Remove old container to avoid name conflicts
- Use --timeout flag (modern Docker CLI) instead of deprecated --time
- Apply fix to all database types: MariaDB, MySQL, PostgreSQL, MongoDB,
  Redis, KeyDB, Dragonfly, and ClickHouse
- Update StopDatabase.php for consistency

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 10:01:54 +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