diff --git a/app/Services/InsForge/InsForgeAuthService.php b/app/Services/InsForge/InsForgeAuthService.php index 69bc40b..24d263d 100644 --- a/app/Services/InsForge/InsForgeAuthService.php +++ b/app/Services/InsForge/InsForgeAuthService.php @@ -46,9 +46,13 @@ class InsForgeAuthService return $this->hydrateProfile($profile); } + private const UUID_PATTERN = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i'; + public function profileById(?string $id): ?User { - if ($id === null) { + // Sesi lama bisa menyimpan identifier non-UUID (mis. "1") — jangan sampai + // mengirim nilai itu ke PostgREST; anggap tidak dikenal dan paksa login ulang. + if (! is_string($id) || preg_match(self::UUID_PATTERN, $id) !== 1) { return null; } diff --git a/storage/framework/sessions/.gitignore b/storage/framework/sessions/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/storage/framework/sessions/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore