# Unchecked Error Condition (CWE-391) The product does not properly check when a function or operation returns a value that is associated with an error condition. **Stack:** Go - Prevalence: Średnia Pokryto 3 języków - Impact: Wysoki 1 reguł o wysokim poziomie - Prevention: Udokumentowane 3 przykładów poprawek **OWASP:** Insecure Design (A04:2021-Insecure Design) - #4 ## Description When error conditions are not checked, the application may continue with invalid or unexpected state, potentially leading to crashes, data corruption, or security vulnerabilities. ## Prevention Strategie zapobiegania dla Unchecked Error Condition oparte na 1 regułach detekcji Shoulder. ### Go Log or return errors instead of silently swallowing them ## Consequences - DoS - Wykonanie nieautoryzowanego kodu - Modyfikacja danych aplikacji ## Mitigations - Sprawdzaj wszystkie zwracane wartości i warunki błędów - Tam, gdzie to wskazane, stosuj obsługę wyjątków - Wdroż właściwe mechanizmy odzyskiwania po błędach ## Detection - Total rules: 3 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (1 rules) - **Empty Error Handling** [LOW]: Error check block is empty, silently swallowing errors. - Remediation: Log or return errors instead of ignoring them silently. ```go if err != nil { log.Printf("operation failed: %v", err) return err } ``` Learn more: https://shoulder.dev/learn/go/cwe-391/empty-error-handling