[SECURITY] Konfigurasi CORS Lebih Ketat - Whitelist Origin Saja#980
Open
pandigresik wants to merge 1 commit intorilis-devfrom
Open
[SECURITY] Konfigurasi CORS Lebih Ketat - Whitelist Origin Saja#980pandigresik wants to merge 1 commit intorilis-devfrom
pandigresik wants to merge 1 commit intorilis-devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Perbaikan issue #964
Keamanan CORS - Ringkasan Perbaikan
📋 Ikhtisar
Perbaikan keamanan kritis pada konfigurasi CORS (Cross-Origin Resource Sharing) untuk mencegah akses API yang tidak sah dari domain yang tidak tepercaya.
Kondisi Sebelumnya
Dampak Keamanan
Kombinasi
allowed_origins = *dengansupports_credentials = trueadalah KERENTANAN KEAMANAN KRITIS.✅ Solusi yang Diterapkan
1. Perubahan
config/cors.php2. Perubahan
.env.exampleDitambahkan variabel environment baru:
3. Test Coverage -
tests/Feature/CorsSecurityTest.php13 test cases yang memastikan konfigurasi CORS aman:
Menjalankan Test:
php artisan test --filter CorsSecurityTest🔧 Konfigurasi untuk Environment
Production
Development
Staging
Multiple Domains
🧪 Testing
Test Preflight dari Domain yang Diizinkan
Test Preflight dari Domain yang TIDAK Diizinkan
Menjalankan Semua Test CORS
📁 File yang Diubah
config/cors.php✅ Restrict allowed headers ke header yang diperlukan
.env.exampleCORS_ALLOWED_ORIGINSenvironment variabletests/Feature/CorsSecurityTest.phpQWEN.md🎯 Checklist Implementasi
allowed_originsdari*ke whitelist domainallowed_headersdari*ke header spesifikCORS_ALLOWED_ORIGINS📚 Referensi
⚡ Quick Commands