# Improper Handling of Exceptional Conditions (CWE-755) The product does not handle or incorrectly handles an exceptional condition. **Stack:** Go - Prevalence: Mittel 3 Sprachen abgedeckt - Impact: Hoch 1 Regeln mit hohem Schweregrad - Prevention: Dokumentiert 4 Fix-Beispiele **OWASP:** Insecure Design (A04:2021-Insecure Design) - #4 ## Description When exceptional conditions are not properly handled, the product may enter an undefined state, crash, or expose sensitive information. This can lead to denial of service, information disclosure, or unexpected behavior. ## Prevention Präventionsstrategien für Improper Handling of Exceptional Conditions basierend auf 1 Shoulder-Erkennungsregeln. ### Go Always check error return values before using other results ## Consequences - DoS - Anwendungsdaten lesen - Nicht autorisierten Code ausführen ## Mitigations - Alle potenziellen Ausnahmebedingungen vorhersehen und angemessen behandeln - try-catch-Blöcke und geeignete Fehlerbehandlungsmechanismen verwenden - Bei einer Ausnahme sicher fehlschlagen ## Detection - Total rules: 4 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (1 rules) - **Incomplete Error Handling** [MEDIUM]: Function returns error but caller does not check err != nil. - Remediation: Check error return values before using other returned values. ```go result, err := process() if err != nil { return err } // Now safe to use result ``` Learn more: https://shoulder.dev/learn/go/cwe-755/incomplete-error-handling