# Improper Handling of Exceptional Conditions (CWE-755) The product does not handle or incorrectly handles an exceptional condition. **Stack:** Go - Prevalence: Średnia Pokryto 3 języków - Impact: Wysoki 1 reguł o wysokim poziomie - Prevention: Udokumentowane 4 przykładów poprawek **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 Strategie zapobiegania dla Improper Handling of Exceptional Conditions oparte na 1 regułach detekcji Shoulder. ### Go Always check error return values before using other results ## Consequences - DoS - Odczyt danych aplikacji - Wykonanie nieautoryzowanego kodu ## Mitigations - Przewiduj wszystkie możliwe sytuacje wyjątkowe i odpowiednio je obsługuj - Stosuj bloki try-catch i właściwe mechanizmy obsługi błędów - W razie wyjątku zawiódź w bezpieczny sposób ## 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