Stack Trace Exposure (ARCH5127)
هذا المحتوى غير متوفر بلغتك بعد.
Key go.security.stack-trace-exposure · Severity warning · Category security · CWE CWE-209
Returning raw error messages or stack traces to the client exposes internal implementation, file paths, and library versions to attackers.
Incorrect
Section titled “Incorrect”func handler(w http.ResponseWriter, r *http.Request) { if err := process(r); err != nil { http.Error(w, err.Error()+"\n"+string(debug.Stack()), 500) return }}Correct
Section titled “Correct”func handler(w http.ResponseWriter, r *http.Request) { if err := process(r); err != nil { log.Printf("process failed: %v", err) http.Error(w, "internal server error", 500) return }}Log error details server-side and return only a generic error message to the client.