Unchecked Return Value
The product does not check the return value from a method or function, which can prevent it from detecting unexpected states and conditions.
When return values are not checked, the program may continue execution in an error state or with incorrect data, potentially leading to security vulnerabilities.
普及度
中
2 言語をカバー
影響度
ハイ
1 件の重大度ハイのルール
予防
文書化済み
2 件の修正例
2 予防
2 予防
この脆弱性の修正方法
2 件の Shoulder 検出ルールに基づく Unchecked Return Value の予防策。
Unchecked Error Return Values
MEDIUM
Replace blank identifier _ with err and check error return values
- data, _ := ioutil.ReadFile(path) + data, err := ioutil.ReadFile(path) + if err != nil { + return fmt.Errorf("failed to read %s: %w", path, err) + } process(data)
JavaScript
すべて表示 JavaScript 詳細 →
Unchecked Return Value from Critical Operations
HIGH
Always check return values from critical operations like password comparison and database writes
- bcrypt.compare(req.body.password, user.passwordHash); - // Proceeds without checking the result + const isValid = await bcrypt.compare(req.body.password, user.passwordHash); + if (!isValid) { + return res.status(401).json({ error: 'Invalid credentials' }); + } const token = generateToken(user);
3 検出
3 検出
コードの脆弱性を見つける
Shoulderを使用してコードのUnchecked Return Valueパターンをスキャンしましょう。 2 ルール.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=252 # Or scan entire project npx @shoulderdev/cli trust .
検出ルール (2)
🐹
Go
1 rules
4 警告サイン
4 警告サイン
コードレビューで注目すべき点
これらのパターンはUnchecked Return Valueの潜在的な脆弱性を示しています。コードレビューとセキュリティ監査中に探してください。
Return value from ... at ... is not checked
javascript-unchecked-return-value
critical operations (file system, database, authentication) whose
return values are not checked
javascript-unchecked-return-value
コードベースをスキャン: Unchecked Return Value
Shoulder CLI はコードベース全体から脆弱なパターンを見つけます。