Open
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.
Ringkasan
Memperbaiki kerentanan keamanan kritis #974 dimana endpoint
/api/v1/tokendapat diakses tanpa autentikasi, memungkinkan siapa saja membuat token API yang valid.Perubahan yang Dilakukan
1. Proteksi Route (
routes/apiv1.php)Sebelum:
Sesudah:
2. Peningkatan Controller (
app/Http/Controllers/Api/Auth/AuthController.php)Ditambahkan:
Sebelum:
Sesudah:
Checklist Keamanan ✅
Semua item diverifikasi dengan tes otomatis:
/api/opendk/dataCakupan Pengujian
Dibuat suite pengujian komprehensif:
tests/Feature/ApiTokenEndpointSecurityTest.phpHasil Tes:
Dampak
Sebelum Perbaikan
/api/v1/tokendan mendapat token API validSetelah Perbaikan
auth:sanctum)role:administrator)Issue Terkait
/api/tokenDapat Diakses Tanpa Autentikasi #974 - [CRITICAL] Endpoint/api/tokenDapat Diakses Tanpa AutentikasiPerubahan Breaking
/api/v1/tokenakan gagal dengan 401/403Panduan Migrasi
Jika Anda punya script sinkronisasi yang ada:
Sebelum:
# Ini TIDAK AKAN BERFUNGSI lagi curl https://your-domain.com/api/v1/tokenSesudah:
File yang Diubah
routes/apiv1.php- Menambahkan middleware role:administratorapp/Http/Controllers/Api/Auth/AuthController.php- Meningkatkan method token()tests/Feature/ApiTokenEndpointSecurityTest.php- Suite pengujian baruPengujian
Jalankan suite pengujian:
php artisan test --filter ApiTokenEndpointSecurityTestPengujian manual:
Audit Keamanan
Perbaikan ini mengatasi:
Rekomendasi
Catatan