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