# Unchecked Return Value (CWE-252) The product does not check the return value from a method or function, which can prevent it from detecting unexpected states and conditions. **Stack:** Go - Prevalence: 中 2 言語をカバー - Impact: ハイ 1 件の重大度ハイのルール - Prevention: 文書化済み 2 件の修正例 **OWASP:** Insecure Design (A04:2021-Insecure Design) - #4 ## Description When return values are not checked, the program may continue execution in an error state or with incorrect data, potentially leading to security vulnerabilities. ## Prevention 1 件の Shoulder 検出ルールに基づく Unchecked Return Value の予防策。 ### Go Replace blank identifier _ with err and check error return values ## Consequences - DoS - 未承認コードの実行 - アプリケーションデータの変更 ## Mitigations - 関数の戻り値は常にチェックする - コンパイラ警告を活用して、未チェックの戻り値を検出する - エラー状態を適切に処理する ## Detection - Total rules: 2 - Languages: go, javascript, typescript ## Rules by Language ### Go (1 rules) - **Unchecked Error Return Values** [MEDIUM]: Error return value ignored using blank identifier (_). - Remediation: Check all error return values and handle appropriately. ```go data, err := ioutil.ReadFile(path) if err != nil { return fmt.Errorf("failed to read file: %w", err) } ``` Learn more: https://shoulder.dev/learn/go/cwe-252/unchecked-errors