Stack trace exposure (ARCH7127)
هذا المحتوى غير متوفر بلغتك بعد.
Key php.security.stack-trace-exposure · Severity warning · Category security · CWE CWE-209
Writing exception details or a stack trace to the HTTP response leaks internal file paths, library versions, and application structure to the client. Errors should be logged on the server and a generic message returned to the client.
Incorrect
Section titled “Incorrect”<?phptry { process($request);} catch (\Throwable $e) { http_response_code(500); echo $e->getMessage() . "\n" . $e->getTraceAsString();}Correct
Section titled “Correct”<?phptry { process($request);} catch (\Throwable $e) { error_log($e); http_response_code(500); echo 'An unexpected error occurred.';}Log exception details to the server log and return only a generic error message to the client.