# Improper Handling of Exceptional Conditions (CWE-755) The product does not handle or incorrectly handles an exceptional condition. **Stack:** Go - Prevalence: Média 3 linguagens cobertas - Impact: Alto 1 regras de severidade alta - Prevention: Documentada 4 exemplos de correção **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 Estratégias de prevenção para Improper Handling of Exceptional Conditions baseadas em 1 regras de detecção do Shoulder. ### Go Always check error return values before using other results ## Consequences - DoS - Ler dados da aplicação - Executar código não autorizado ## Mitigations - Antecipe todas as condições excepcionais potenciais e trate-as adequadamente - Use blocos try-catch e mecanismos apropriados de tratamento de erros - Falhe de forma segura quando ocorrer uma exceção ## 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