Block web access to generate_api_key.php
Added php_sapi_name() CLI guard matching the pattern used in migrate.php and cleanup_ratelimit.php. Without this, the script was web-accessible and could generate an API key without authentication if no keys existed yet. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,12 @@
|
||||
* Usage: php generate_api_key.php
|
||||
*/
|
||||
|
||||
// Prevent web access
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
http_response_code(403);
|
||||
exit('CLI access only');
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/config/config.php';
|
||||
require_once __DIR__ . '/models/ApiKeyModel.php';
|
||||
require_once __DIR__ . '/models/UserModel.php';
|
||||
|
||||
Reference in New Issue
Block a user