security: Remove all hardcoded secret keys from codebase and enforce strict getenv environment loading

This commit is contained in:
Hamza-Ayed
2026-08-28 02:34:13 +03:00
parent 7b778a1879
commit 7ddaff6b14
2 changed files with 33 additions and 44 deletions
+9 -9
View File
@@ -351,10 +351,10 @@ class VideoService
private static function getBunnyConfig(): array
{
return [
'library_id' => getenv('BUNNY_STREAM_LIBRARY_ID') ?: '285491',
'library_id' => getenv('BUNNY_STREAM_LIBRARY_ID') ?: '',
'api_key' => getenv('BUNNY_STREAM_API_KEY') ?: '',
'token_key' => getenv('BUNNY_STREAM_TOKEN_KEY') ?: getenv('JWT_SECRET') ?: 'SaqelSecureBunnyToken2026',
'pull_zone_host' => getenv('BUNNY_STREAM_HOST') ?: 'vz-saqel.b-cdn.net',
'token_key' => getenv('BUNNY_STREAM_TOKEN_KEY') ?: getenv('JWT_SECRET') ?: '',
'pull_zone_host' => getenv('BUNNY_STREAM_HOST') ?: '',
'embed_host' => 'iframe.mediadelivery.net'
];
}
@@ -483,12 +483,12 @@ class VideoService
public static function getR2Config(): array
{
return [
'account_id' => getenv('CLOUDFLARE_R2_ACCOUNT_ID') ?: 'fd6e6388f69f6b2d7c073861f9bef4ee',
'access_key' => getenv('CLOUDFLARE_R2_ACCESS_KEY') ?: 'ba4df2726c7e717f2c4b7fff7db0e1ea',
'secret_key' => getenv('CLOUDFLARE_R2_SECRET_KEY') ?: 'ce5dfeef2b89e4bb2760c2e856006cc201e6218018a5d2bf25188a2ced61687b',
'endpoint' => getenv('CLOUDFLARE_R2_ENDPOINT') ?: 'https://fd6e6388f69f6b2d7c073861f9bef4ee.r2.cloudflarestorage.com',
'bucket' => getenv('CLOUDFLARE_R2_BUCKET') ?: 'saqel-media',
'public_url' => getenv('CLOUDFLARE_R2_PUBLIC_URL') ?: 'https://pub-85b40493a03d464cb6c5b4adb43749f5.r2.dev'
'account_id' => getenv('CLOUDFLARE_R2_ACCOUNT_ID') ?: '',
'access_key' => getenv('CLOUDFLARE_R2_ACCESS_KEY') ?: '',
'secret_key' => getenv('CLOUDFLARE_R2_SECRET_KEY') ?: '',
'endpoint' => getenv('CLOUDFLARE_R2_ENDPOINT') ?: '',
'bucket' => getenv('CLOUDFLARE_R2_BUCKET') ?: '',
'public_url' => getenv('CLOUDFLARE_R2_PUBLIC_URL') ?: ''
];
}