# Generation of Error Message Containing Sensitive Information (CWE-209) The product generates an error message that includes sensitive information about its environment, users, or associated data. **Stack:** Go - Prevalence: मध्यम 3 भाषाएँ कवर की गईं - Impact: मध्यम समीक्षा अनुशंसित - Prevention: प्रलेखित 5 फिक्स उदाहरण **OWASP:** Insecure Design (A04:2021-Insecure Design) - #4 ## Description The sensitive information may be valuable information on its own, or it may be useful for launching other, more serious attacks. The error message may be created in different ways, and the information that is included can range widely. ## Prevention 1 Shoulder डिटेक्शन नियमों पर आधारित Error Message Information Leak के लिए रोकथाम रणनीतियाँ। ### Go Return generic error messages to clients; log detailed errors server-side ## Consequences - एप्लिकेशन डेटा पढ़ना - फ़ाइलें या डायरेक्टरीज़ पढ़ना ## Mitigations - अपवादों को आंतरिक रूप से संभालें और उपयोगकर्ता को त्रुटियाँ न दिखाएँ - 404 और 500 जैसी HTTP त्रुटियों के लिए डिफ़ॉल्ट त्रुटि पेज बनाएँ - ऐसा उचित त्रुटि प्रबंधन लागू करें जो सर्वर-साइड पर विस्तृत त्रुटियाँ लॉग करे लेकिन उपयोगकर्ताओं को सामान्य संदेश दिखाए ## Detection - Total rules: 5 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (1 rules) - **Database Error Information Exposure in HTTP Response** [MEDIUM]: Internal error messages or stack traces exposed to users in HTTP responses. - Remediation: Return generic error messages to users, log details server-side. ```go if err != nil { log.Printf("internal error: %v", err) // Log details http.Error(w, "An error occurred", 500) // Generic response return } ``` Learn more: https://shoulder.dev/learn/go/cwe-209/error-message-exposure