# 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: 中 3 言語をカバー - Impact: ハイ 1 件の重大度ハイのルール - Prevention: 文書化済み 3 件の修正例 **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 1 件の Shoulder 検出ルールに基づく Unchecked Error Condition の予防策。 ### Go Log or return errors instead of silently swallowing them ## Consequences - DoS - 未承認コードの実行 - アプリケーションデータの変更 ## Mitigations - すべての戻り値とエラー条件をチェックする - 適切な箇所で例外処理を用いる - 適切なエラーリカバリ機構を実装する ## 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