From 2b6e097fc1a7c1da53c6099fc2385304ff156e8e Mon Sep 17 00:00:00 2001 From: sungro815 Date: Fri, 6 Feb 2026 18:58:21 +0900 Subject: [PATCH] =?UTF-8?q?=ED=94=84=EB=A1=9C=EB=B0=94=EC=9D=B4=EB=8D=94?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Providers/AppServiceProvider.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index dda9235..964dda8 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use App\Support\LegacyCrypto\CiSeedCrypto; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Http\Request; use Illuminate\Support\Facades\RateLimiter; @@ -17,11 +18,25 @@ class AppServiceProvider extends ServiceProvider } $this->app->singleton(CiSeedCrypto::class, function () { - $key = (string) config('legacy.seed_user_key_default', ''); - $iv = (string) config('legacy.iv', ''); + $key = config('legacy.seed_user_key_default', ''); + $iv = config('legacy.iv', []); - if ($key === '' || $iv === '') { - throw new \RuntimeException('legacy crypto config missing (seed_user_key_default/iv)'); + // key는 string + if (!is_string($key) || $key === '') { + throw new \RuntimeException('legacy crypto key missing (seed_user_key_default)'); + } + + // iv는 array (16 bytes) + if (!is_array($iv)) { + throw new \RuntimeException('legacy iv must be array'); + } + if (count($iv) !== 16) { + throw new \RuntimeException('legacy iv array must be 16 bytes'); + } + foreach ($iv as $b) { + if (!is_int($b) || $b < 0 || $b > 255) { + throw new \RuntimeException('legacy iv array values must be ints 0~255'); + } } return new CiSeedCrypto($key, $iv);