mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-13 08:15:24 +00:00
feat(sentinel): embed server UUID in encrypted sentinel token
Replace random string with encrypted JSON payload containing server_uuid, binding token to its server for validation. Remove double-encrypt test no longer relevant to new token format.
This commit is contained in:
1 parent
3a42ceb67d
commit
4575106f53
2 files changed
+4
-17
No files matched your search
@@ -6,7 +6,6 @@ use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
#[OA\Schema(
|
||||
@@ -189,7 +188,10 @@ class ServerSetting extends Model
|
||||
|
||||
public function generateSentinelToken(bool $save = true, bool $ignoreEvent = false): string
|
||||
{
|
||||
$token = Str::random(64);
|
||||
$data = [
|
||||
'server_uuid' => $this->server->uuid,
|
||||
];
|
||||
$token = encrypt(json_encode($data));
|
||||
$this->sentinel_token = $token;
|
||||
if ($save) {
|
||||
if ($ignoreEvent) {
|
||||
|
||||
Reference in new issue
Block a user