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는 전체 코드베이스에서 취약한 패턴을 찾아냅니다.