An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: add authorization checks to database Livewire components
Andras Bacsaie20327b9c4e4
diff --git a/app/Livewire/Project/Database/BackupEdit.php b/app/Livewire/Project/Database/BackupEdit.phpindex b3df790082..7deaa82a9d 100644--- a/app/Livewire/Project/Database/BackupEdit.php+++ b/app/Livewire/Project/Database/BackupEdit.php@@ -85,6 +85,7 @@ class BackupEdit extends Componentpublic function mount(){try {+ $this->authorize('view', $this->backup->database);$this->parameters = get_route_parameters();$this->syncData();} catch (Exception $e) {diff --git a/app/Livewire/Project/Database/Clickhouse/General.php b/app/Livewire/Project/Database/Clickhouse/General.phpindex d41609c75b..c4a7983b8f 100644--- a/app/Livewire/Project/Database/Clickhouse/General.php+++ b/app/Livewire/Project/Database/Clickhouse/General.php@@ -56,6 +56,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Configuration.php b/app/Livewire/Project/Database/Configuration.phpindex 88ecccf995..513ba9f164 100644--- a/app/Livewire/Project/Database/Configuration.php+++ b/app/Livewire/Project/Database/Configuration.php@@ -3,10 +3,12 @@namespace App\Livewire\Project\Database;use Auth;+use Illuminate\Foundation\Auth\Access\AuthorizesRequests;use Livewire\Component;class Configuration extends Component{+ use AuthorizesRequests;public $currentRoute;public $database;@@ -42,6 +44,8 @@ class Configuration extends Component->where('uuid', request()->route('database_uuid'))->firstOrFail();+ $this->authorize('view', $database);+$this->database = $database;$this->project = $project;$this->environment = $environment;diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.phpindex 69633e302a..9052a4749e 100644--- a/app/Livewire/Project/Database/Dragonfly/General.php+++ b/app/Livewire/Project/Database/Dragonfly/General.php@@ -62,6 +62,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.phpindex 3f974f63d1..7d6ac3131c 100644--- a/app/Livewire/Project/Database/Import.php+++ b/app/Livewire/Project/Database/Import.php@@ -131,6 +131,7 @@ EOD;if (is_null($resource)) {abort(404);}+ $this->authorize('view', $resource);$this->resource = $resource;$this->server = $this->resource->destination->server;$this->container = $this->resource->uuid;diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.phpindex 20d0486dcb..6d21988e7b 100644--- a/app/Livewire/Project/Database/Keydb/General.php+++ b/app/Livewire/Project/Database/Keydb/General.php@@ -64,6 +64,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.phpindex 4de73f61c2..429cfc387d 100644--- a/app/Livewire/Project/Database/Mariadb/General.php+++ b/app/Livewire/Project/Database/Mariadb/General.php@@ -122,6 +122,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.phpindex 534e90bc4c..ae725fa4b6 100644--- a/app/Livewire/Project/Database/Mongodb/General.php+++ b/app/Livewire/Project/Database/Mongodb/General.php@@ -122,6 +122,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.phpindex b66165527c..cffedcd23c 100644--- a/app/Livewire/Project/Database/Mysql/General.php+++ b/app/Livewire/Project/Database/Mysql/General.php@@ -127,6 +127,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.phpindex eae6870b67..3240aadd27 100644--- a/app/Livewire/Project/Database/Postgresql/General.php+++ b/app/Livewire/Project/Database/Postgresql/General.php@@ -140,6 +140,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.phpindex 6a17a60530..846614d21e 100644--- a/app/Livewire/Project/Database/Redis/General.php+++ b/app/Livewire/Project/Database/Redis/General.php@@ -115,6 +115,7 @@ class General extends Componentpublic function mount(){try {+ $this->authorize('view', $this->database);$this->syncData();$this->server = data_get($this->database, 'destination.server');if (! $this->server) {