Unchecked Error Condition
The product does not properly check when a function or operation returns a value that is associated with an error condition.
When error conditions are not checked, the application may continue with invalid or unexpected state, potentially leading to crashes, data corruption, or security vulnerabilities.
How to fix this vulnerability
Prevention strategies for Unchecked Error Condition based on 3 Shoulder detection rules.
Log or return errors instead of silently swallowing them
_, err := db.Exec("DELETE FROM sessions WHERE expired = true") if err != nil { + log.Printf("session cleanup failed: %v", err) + return err }
Always handle promise rejections with .catch() or try/catch in async functions
app.post('/create', async (req, res) => { - const user = await User.create(req.body); - res.json(user); + try { + const user = await User.create(req.body); + res.json(user); + } catch (error) { + logger.error('User creation failed:', error); + res.status(500).json({ error: 'Could not create user' }); + } });
Log exceptions or handle them explicitly instead of silently swallowing with pass
- def get_data(): - try: - data = fetch_sensitive_data() - return {'data': data} - except: - pass + import logging + + logger = logging.getLogger(__name__) + + def get_data(): + try: + data = fetch_sensitive_data() + return {'data': data} + except Exception as e: + logger.error(f"Failed to fetch data: {e}", exc_info=True) + return {'error': 'Data unavailable'}, 500
Find vulnerabilities in your code
Use Shoulder to scan your codebase for Unchecked Error Condition patterns. 3 rules.
# Scan with Shoulder CLI npx @shoulderdev/cli trust --cwe=391 # Or scan entire project npx @shoulderdev/cli trust .
Detection Rules (3)
What to watch for in code reviews
These patterns indicate potential Unchecked Error Condition vulnerabilities. Look for these during code reviews and security audits.
Scan your codebase for Unchecked Error Condition
Shoulder CLI finds vulnerable patterns across your entire codebase.