Commit graph

111 commits

Author SHA1 Message Date
Andras Bacsai
bf72fd5d88 refactor(backups): centralize storage deletion guard 2026-07-19 23:20:46 +02:00
Andras Bacsai
b97a97e955 Merge remote-tracking branch 'origin/next' into volume-backups-server-s3 2026-07-19 21:45:26 +02:00
Andras Bacsai
0633b543ee feat(api): require POST for state-changing endpoints
Make start/stop/restart, deploy, enable/disable, and server validate
POST-only, with GET returning 405. Server validate accepts optional
install and uses ValidateAndInstallServerJob. Update OpenAPI and tests.
2026-07-19 11:42:04 +02:00
Andras Bacsai
662633399f Merge remote-tracking branch 'origin/next' into volume-backups-server-s3 2026-07-18 16:07:26 +02:00
Andras Bacsai
28f8867567 feat(api): add volume backup schedule delete endpoints
Expose DELETE for application, database, and service storage backup
schedules (with OpenAPI docs), reject storage deletes while schedules
exist, skip retention cleanup when no limits are set, and remove S3
archives using the execution’s S3 storage.
2026-07-16 21:44:48 +02:00
Andras Bacsai
913d033c75
fix(resources): clarify build server hosting restrictions (#10961) 2026-07-16 21:35:23 +02:00
Andras Bacsai
64667574f6 fix(api): correct service and application OpenAPI schemas 2026-07-15 12:29:20 +02:00
Andras Bacsai
cf63c7d154 Merge remote-tracking branch 'origin/next' into feat/api-move-resources-between-projects 2026-07-07 18:13:37 +02:00
Andras Bacsai
aded45acbe Merge remote-tracking branch 'origin/next' into feat/api/tag-management 2026-07-07 14:02:45 +02:00
Andras Bacsai
11b35ba3c1 feat(api): add tags to resource creation
Normalize tag names before attaching them, reject names that are too short
after sanitization, and return 404 when removing tags not attached to the
resource.

Adds a per-team unique tag-name index and migrates duplicate tags onto the
kept record before creating the constraint.
2026-07-07 13:56:33 +02:00
Andras Bacsai
ff976a134f Merge remote-tracking branch 'origin/next' into api-sensitive-data-scrubber 2026-07-07 12:56:19 +02:00
Andras Bacsai
f617e58401 Merge remote-tracking branch 'origin/next' into feat/api/tag-management
# Conflicts:
#	app/Http/Controllers/Api/ApplicationsController.php
2026-07-07 12:49:19 +02:00
Andras Bacsai
ff5cfd4253 fix(api): normalize log endpoint query handling
Clamp log line counts, parse timestamp flags consistently, and filter
service subcontainers by Coolify labels. Document log endpoint timestamp
parameters and database/service log routes in OpenAPI.
2026-07-06 23:58:12 +02:00
Andras Bacsai
adc4b3091f Merge remote-tracking branch 'origin/next' into feat/database-service-logs-endpoint 2026-07-06 23:29:54 +02:00
Andras Bacsai
bbff70c8d0 fix: improve application URL handling 2026-07-02 16:52:07 +02:00
Andras Bacsai
13172849e1 Merge remote-tracking branch 'origin/next' into api-sensitive-data-scrubber 2026-07-02 15:57:43 +02:00
Andras Bacsai
6871160623 fix(api): gate sensitive storage and GitHub fields
Expose GitHub app secrets and file storage content only when the request has sensitive read access. Hide LocalFileVolume content by default and resolve application UUIDs from route parameters.
2026-07-02 15:50:43 +02:00
Andras Bacsai
a06c1a7bf5 Improve storage mount path handling 2026-07-02 14:54:38 +02:00
Andras Bacsai
87d4744390 Validate environment variable keys 2026-06-25 18:19:58 +02:00
Andras Bacsai
f5ecdfa4ce Merge remote-tracking branch 'origin/next' into api-sensitive-data-scrubber 2026-06-15 13:29:25 +02:00
Andras Bacsai
c175d3d282 Merge remote-tracking branch 'origin/next' into audit-policies 2026-05-11 21:13:57 +02:00
Andras Bacsai
12aba41d9a fix(api): gate service server secrets by sensitive scope
Only eager load nested server settings for service responses when the API token has read:sensitive, preventing read-only tokens from exposing sentinel fields while preserving sensitive access.
2026-05-11 11:53:22 +02:00
Andras Bacsai
8dc79f4ed6 fix(api): expose nested server secrets for privileged tokens
Add `exposeNestedServerSecrets()` to Applications, Databases, and
Services controllers so that `read:sensitive`/`root` tokens see
sentinel and logdrain fields on eager-loaded Server + ServerSetting
relations.

ServicesController handles both single models and Eloquent Collections
(listing endpoint passes a Collection per project).

Tests tightened to use JSON-key assertions (`"field":`) to avoid false
positives from field names appearing in values.
2026-04-30 11:49:15 +02:00
Andras Bacsai
8b7dbbafb2 fix(api): hide sensitive fields by default, expose via makeVisible for privileged tokens
Models now declare $hidden for passwords, tokens, db URLs, and compose
fields. API controllers flip from makeHidden-on-deny to makeVisible-on-
allow (can_read_sensitive=true), fixing fields that were never hidden.
Also adds missing fields (mysql/mariadb passwords, logdrain keys, etc.)
to privileged disclosure lists.

Tests added: Feature/Security/ApiSensitiveFieldsTest and
Unit/Models/SensitiveFieldsHiddenTest cover all affected models and
controllers.
2026-04-30 11:28:06 +02:00
Andras Bacsai
a2096c6f68 feat(observability): add structured audit log channel for API and webhook events
Introduce a dedicated `audit` log channel (daily rotation, configurable retention via
LOG_AUDIT_DAYS) and a small `auditLog()` / `auditLogWebhookFailure()` helper used to
record state-changing API operations and webhook events.

Instrumented:

- API mutation endpoints (create / update / delete / start / stop / restart) across
  applications, services, databases (incl. backups, env vars, storage), servers,
  projects + environments, scheduled tasks, private keys, GitHub apps, cloud provider
  tokens, Hetzner server provisioning, instance enable/disable.
- Webhook signature verification outcomes for GitHub, GitLab, Bitbucket, Gitea and
  Stripe, plus the Sentinel push endpoint.
- Authentication and authorization outcomes via the global exception handler and
  the `ApiAbility` middleware (unauthenticated, ability-denied, policy-denied).

The helper is wrapped in try/catch so logging failures never affect the request
path. Successful operations log at `info`; suspicious/denied requests log at
`warning`. Operators wanting a failures-only feed can set `LOG_AUDIT_LEVEL=warning`.

Includes a feature test suite covering the helper, the webhook providers and the
new auth/authorization log paths.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 14:50:37 +02:00
Andras Bacsai
410a9a6195 refactor(volumes): validate input and escape shell args
Tighten validation on volume name and host path inputs across Livewire + API storage endpoints and escape shell arguments in volume clone and compose preview cleanup paths.
2026-04-20 11:27:10 +02:00
Andras Bacsai
43f33d94ad Merge remote-tracking branch 'origin/next' into audit-policies
# Conflicts:
#	app/Http/Controllers/Api/SecurityController.php
#	app/Http/Controllers/Api/ServersController.php
#	app/Livewire/Admin/Index.php
#	app/Livewire/Destination/Show.php
#	app/Livewire/NavbarDeleteTeam.php
#	app/Livewire/Project/Application/Previews.php
#	app/Livewire/Project/DeleteProject.php
#	app/Livewire/Project/Shared/ResourceOperations.php
#	app/Livewire/Server/Resources.php
#	app/Livewire/Server/ValidateAndInstall.php
#	app/Livewire/Storage/Show.php
#	resources/views/livewire/dashboard.blade.php
#	resources/views/livewire/project/application/heading.blade.php
#	resources/views/livewire/project/database/heading.blade.php
#	resources/views/livewire/project/service/heading.blade.php
#	resources/views/livewire/project/shared/environment-variable/show.blade.php
#	resources/views/livewire/project/shared/scheduled-task/show.blade.php
#	tests/Feature/Security/TrustHostsMiddlewareTest.php
2026-04-19 15:19:37 +02:00
Andras Bacsai
07c6b02a82 Merge remote-tracking branch 'origin/next' into jean/organize-service-ui 2026-04-14 10:52:01 +02:00
Andras Bacsai
1a603a10ed fix(models): replace forceFill/forceCreate with fill/create and add fillable guards
Replace all uses of `forceFill`, `forceCreate`, and `forceFill` with their
non-force equivalents across models, actions, controllers, and Livewire
components. Add explicit `$fillable` arrays to all affected Eloquent models
to enforce mass assignment protection.

Add ModelFillableCreationTest and ModelFillableRegressionTest to verify that
model creation respects fillable constraints and prevent regressions.
2026-03-31 13:45:31 +02:00
Andras Bacsai
1da1f32f0e refactor: use forceCreate() for internal model creation
Replace create() with forceCreate() across internal model creation operations to bypass mass assignment protection. This is appropriate for internal code that constructs complete model state without user input.

Add InternalModelCreationMassAssignmentTest to ensure internal model creation behavior is properly tested. Optimize imports by using shortened Livewire attribute references and removing unused imports.
2026-03-30 13:04:11 +02:00
Michael Jathe
23d5b854e9 feat(api): add tag management endpoints for applications, databases, and services
Add CRUD tag endpoints (GET/POST/DELETE) as sub-resources for applications,
databases, and services. Add team-level GET /tags endpoint. Extend all
resource creation endpoints to accept an optional tags array.

Uses a shared HandlesTagsApi trait to avoid duplication across controllers.
Tags are race-safe via syncWithoutDetaching(), garbage-collected when orphaned,
and sanitized (strip_tags + lowercase).
2026-03-29 16:02:05 +02:00
Andras Bacsai
f9a9dc80aa fix(api): add volume name validation to storage API endpoints
Apply the same Docker volume name pattern validation to the API
create and update storage endpoints for applications, databases,
and services controllers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 12:17:39 +01:00
Andras Bacsai
3fdce06b65 fix(storage): consistent path validation and escaping for file volumes
Ensure all file volume paths are validated and properly escaped before
use. Previously, only directory mount paths were validated at the input
layer — file mount paths now receive the same treatment across Livewire
components, API controllers, and the model layer.

- Validate and escape fs_path at the top of saveStorageOnServer() before
  any commands are built
- Add path validation to submitFileStorage() in Storage Livewire component
- Add path validation to file mount creation in Applications, Services,
  and Databases API controllers
- Add regression tests for path validation coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 23:44:37 +01:00
Andras Bacsai
ae33447994 feat(storage): add storage endpoints and UUID support for databases and services
- Add storage endpoints (list, create, update, delete) to DatabasesController
- Add storage endpoints (list, create, update, delete) to ServicesController
- Add UUID field and migration for local_persistent_volumes table
- Update LocalPersistentVolume model to extend BaseModel
- Support UUID-based storage identification in ApplicationsController
- Update OpenAPI documentation with new storage endpoints and schemas
- Fix application name generation to extract repo name from full git path
- Add comprehensive tests for storage API operations
2026-03-23 15:15:02 +01:00
Andras Bacsai
fb76b68c08 feat(api): support comments in bulk environment variable endpoints
Add support for optional comment field on environment variables created or
updated through the bulk API endpoints. Comments are validated to a maximum
of 256 characters and are nullable. Updates preserve existing comments when
not provided in the request.
2026-03-19 22:17:55 +01:00
Andras Bacsai
8a164735cb fix(api): extract resource UUIDs from route parameters
Extract resource UUIDs from route parameters instead of request body
in ApplicationsController and ServicesController environment variable
endpoints. This prevents UUID parameters from being spoofed in the
request body.

- Replace $request->uuid with $request->route('uuid')
- Replace $request->env_uuid with $request->route('env_uuid')
- Add tests verifying route parameters are used and body UUIDs ignored
2026-03-19 21:56:58 +01:00
ShadowArcanist
820f699853 fix(ui): updated example domains on helper text to be https instead of http
we were setting a bad example by showing http because user will enter their domain in http and wonder why they cannot access their site over https, also user don't know how to use multiple domains with port numbers so covered it on this change as well
2026-03-18 12:53:24 +05:30
Niklas Wichter
6b9a755e32 feat(api): add POST /move endpoints for applications, databases, and services 2026-03-13 16:32:00 +01:00
Andras Bacsai
b9cae51c5d feat(service): add container label escape control to services API
Add `is_container_label_escape_enabled` boolean field to services API,
allowing users to control whether special characters in container labels
are escaped. Defaults to true (escaping enabled).

When disabled, users can use environment variables within labels.
Includes validation rules and comprehensive test coverage.
2026-03-13 13:32:58 +01:00
Andras Bacsai
eb96c9550b
fix(api): add docker_cleanup parameter to stop endpoints (#8899) 2026-03-11 10:18:22 +01:00
Andras Bacsai
f83c71fd4f Merge remote-tracking branch 'origin/next' into audit-policies 2026-03-06 08:04:10 +01:00
Andras Bacsai
11007771f0
Fix/wrong destinations api (#8646) 2026-03-05 16:32:09 +01:00
Andras Bacsai
7154febf32 Merge remote-tracking branch 'origin/next' into audit-policies 2026-03-02 12:41:30 +01:00
Andras Bacsai
d9e39ba211 Merge remote-tracking branch 'origin/next' into env-var-descriptions 2026-02-28 00:09:54 +01:00
Andras Bacsai
b878dc8102 refactor(auth): enforce team member authorization across app
Restrict sensitive operations to admins/owners and hide sensitive data
from team members:
- Add authorization checks to Livewire components and API endpoints
- Restrict team members from accessing sensitive permissions and data
- Hide environment variable values from non-admin team members
- Update policies to enforce team-level admin status requirement
- Add useSensitivePermissions policy for read:sensitive tokens
- Improve disabled button UX with auth-specific tooltips
- Add authorization checks in middleware for API tokens

Closes authorization gaps in project management, server management,
and settings components.
2026-02-27 11:41:01 +01:00
W8jonas
7c5a6bc96c Fix wrong destination issue on create_service 2026-02-26 23:15:18 -03:00
Andras Bacsai
95e93ad899 chore: prepare for PR 2026-02-09 14:48:16 +01:00
🏔️ Peak
b87d54f9e4
feat(api): add url update support to services api (#7929) 2026-01-14 14:51:50 +01:00
peaklabs-dev
ae9d0ec817
docs(api): change domains to urls 2026-01-14 14:50:48 +01:00
peaklabs-dev
33d3f196cc
chore(api): improve current request error message 2026-01-14 14:42:35 +01:00