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
Security fix redis password and username logic
ayntk-ai388f8c4e9533
diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.phpindex 8a202ea9eb..b08825bd41 100644--- a/app/Models/StandaloneRedis.php+++ b/app/Models/StandaloneRedis.php@@ -16,6 +16,14 @@ class StandaloneRedis extends BaseModelprotected $appends = ['internal_db_url', 'external_db_url', 'database_type', 'server_status'];+ protected $casts = [+ 'redis_password' => 'encrypted',+ ];++ protected $attributes = [+ 'redis_username' => 'redis',+ ];+protected static function booted(){static::created(function ($database) {@@ -205,7 +213,11 @@ class StandaloneRedis extends BaseModelprotected function internalDbUrl(): Attribute{return new Attribute(- get: fn () => "redis://:{$this->redis_password}@{$this->uuid}:6379/0",+ get: function () {+ $redis_version = $this->get_redis_version();+ $username_part = version_compare($redis_version, '6.0', '>=') ? "{$this->redis_username}:" : "";+ return "redis://{$username_part}{$this->redis_password}@{$this->uuid}:6379/0";+ });}@@ -214,14 +226,21 @@ class StandaloneRedis extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {- return "redis://:{$this->redis_password}@{$this->destination->server->getIp}:{$this->public_port}/0";+ $redis_version = $this->get_redis_version();+ $username_part = version_compare($redis_version, '6.0', '>=') ? "{$this->redis_username}:" : "";+ return "redis://{$username_part}{$this->redis_password}@{$this->destination->server->getIp}:{$this->public_port}/0";}-return null;});}+ private function get_redis_version()+ {+ $image_parts = explode(':', $this->image);+ return $image_parts[1] ?? '0.0';+ }+public function environment(){return $this->belongsTo(Environment::class);@@ -285,4 +304,4 @@ class StandaloneRedis extends BaseModelreturn $parsedCollection->toArray();}}-}+}\ No newline at end of file