베타 Shoulder는 베타 버전입니다 — 결과가 가끔 잘못될 수 있습니다. 여러분의 피드백이 다음에 무엇을 고칠지 결정합니다. 피드백 공유
🔒

Use of Hard-coded, Security-relevant Constants

🛡️ 2 개의 규칙이 이를 탐지합니다

Use of Hard-coded, Security-relevant Constants

The product uses hard-coded constants instead of symbolic names for security-critical values, which increases the likelihood of mistakes during code maintenance or security reviews.

Hard-coded values make code harder to understand and maintain. When security-relevant values are hard-coded, it increases the risk of errors when the code needs to be modified.

보급률
특정
2개 언어 지원
영향
보통
검토 권장
예방
문서화됨
2개의 수정 예시
2 예방
2 예방

이 취약점을 수정하는 방법

2개의 Shoulder 탐지 규칙을 기반으로 한 Hardcoded Security Constants 예방 전략.

Hardcoded Development URLs LOW

Use environment variables for URLs with localhost as a development fallback

+1 -1 javascript
- const API_URL = 'http://localhost:3000';
+ const API_URL = process.env.API_URL || 'http://localhost:3000';
  const response = await fetch(`${API_URL}/users`);
  
Hardcoded Development URLs LOW

Load URLs from environment variables with localhost as the development fallback

+4 -2 python
- API_URL = "http://localhost:3000/api"
- DB_HOST = "127.0.0.1"
+ import os
+ 
+ API_URL = os.getenv('API_URL', 'http://localhost:3000/api')
+ DB_HOST = os.getenv('DB_HOST', 'localhost')
  
  def fetch_data():
      response = requests.get(f'{API_URL}/data')
      return response.json()
  

핵심 실천 사항

  • Use environment variables
  • configurable via environment variables
4 경고 신호
4 경고 신호

코드 리뷰에서 주의할 점

이 패턴은 잠재적인 Use of Hard-coded, Security-relevant Constants 취약점을 나타냅니다. 코드 리뷰와 보안 감사 중에 찾아보세요.

🔵
Hardcoded development URL found: ... Development URLs like localhost should be configured via environment variables. javascript-hardcoded-dev-urls
🔵
hardcoded development URLs (localhost, 127 javascript-hardcoded-dev-urls
🔵
Development URL found at line ...: ... python-hardcoded-dev-urls
🔵
hardcoded development URLs such as localhost or 127 python-hardcoded-dev-urls
🔍

코드베이스를 스캔하세요: Use of Hard-coded, Security-relevant Constants

Shoulder CLI는 전체 코드베이스에서 취약한 패턴을 찾아냅니다.