- Move 45 debug/test files from root to organized scripts/ directories - Secure public/ directory by removing debug files (security improvement) - Create structured scripts organization: • scripts/debug/ (20 files) - Framework debugging tools • scripts/test/ (18 files) - Test and validation scripts • scripts/maintenance/ (5 files) - Maintenance utilities • scripts/dev/ (2 files) - Development tools Security improvements: - Removed all debug/test files from public/ directory - Only production files remain: index.php, health.php Root directory cleanup: - Reduced from 47 to 2 PHP files in root - Only essential production files: console.php, worker.php This improves: ✅ Security (no debug code in public/) ✅ Organization (clear separation of concerns) ✅ Maintainability (easy to find and manage scripts) ✅ Professional structure (clean root directory)
50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
// Security test endpoint for production deployment validation
|
|
declare(strict_types=1);
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$tests = [
|
|
'environment' => [
|
|
'app_env' => $_ENV['APP_ENV'] ?? 'not-set',
|
|
'app_debug' => $_ENV['APP_DEBUG'] ?? 'not-set',
|
|
'status' => ($_ENV['APP_ENV'] ?? '') === 'production' && ($_ENV['APP_DEBUG'] ?? '') === 'false' ? 'PASS' : 'FAIL'
|
|
],
|
|
'performance_debug' => [
|
|
'analytics_track_performance' => $_ENV['ANALYTICS_TRACK_PERFORMANCE'] ?? 'not-set',
|
|
'status' => (strpos($_ENV['ANALYTICS_TRACK_PERFORMANCE'] ?? '', 'false') !== false) ? 'PASS' : 'FAIL'
|
|
],
|
|
'xdebug' => [
|
|
'xdebug_mode' => $_ENV['XDEBUG_MODE'] ?? 'not-set',
|
|
'status' => ($_ENV['XDEBUG_MODE'] ?? '') === 'off' ? 'PASS' : 'FAIL'
|
|
],
|
|
'security_headers' => [
|
|
'https_only' => isset($_SERVER['HTTPS']) ? 'PASS' : 'FAIL',
|
|
'user_agent_required' => !empty($_SERVER['HTTP_USER_AGENT']) ? 'PASS' : 'FAIL'
|
|
]
|
|
];
|
|
|
|
// Calculate overall status
|
|
$overall_status = 'PASS';
|
|
foreach ($tests as $category => $test) {
|
|
if (isset($test['status']) && $test['status'] === 'FAIL') {
|
|
$overall_status = 'FAIL';
|
|
break;
|
|
}
|
|
if (is_array($test)) {
|
|
foreach ($test as $key => $value) {
|
|
if ($key === 'status' || !is_string($value)) continue;
|
|
if ($value === 'FAIL') {
|
|
$overall_status = 'FAIL';
|
|
break 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
echo json_encode([
|
|
'overall_status' => $overall_status,
|
|
'timestamp' => date('Y-m-d H:i:s'),
|
|
'tests' => $tests
|
|
], JSON_PRETTY_PRINT);
|
|
?>
|