बीटा Shoulder बीटा में है — परिणाम कभी-कभी गलत हो सकते हैं। आपकी प्रतिक्रिया तय करती है कि हम आगे क्या ठीक करें। प्रतिक्रिया साझा करें
↩️

Unchecked Return Value

🛡️ 2 नियम इसे पहचानते हैं

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

+4 -1 go
- data, _ := ioutil.ReadFile(path)
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+     return fmt.Errorf("failed to read %s: %w", path, err)
+ }
  process(data)
  
Unchecked Return Value from Critical Operations HIGH

Always check return values from critical operations like password comparison and database writes

+4 -2 javascript
- 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 पहचान

अपने कोड में भेद्यताएँ खोजें

Unchecked Return Value पैटर्न के लिए अपने कोडबेस को स्कैन करने के लिए Shoulder का उपयोग करें। 2 नियम.

टर्मिनल
# Scan with Shoulder CLI
npx @shoulderdev/cli trust --cwe=252

# Or scan entire project
npx @shoulderdev/cli trust .
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 आपके पूरे कोडबेस में भेद्य पैटर्न खोजता है।