BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback
🔒

Use of Hard-coded, Security-relevant Constants

🛡️ 2 rules detect this

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.

Prevalence
Focused
2 languages covered
Impact
Medium
Review recommended
Prevention
Documented
2 fix examples
2 Prevention
2 Prevention

How to fix this vulnerability

Prevention strategies for Hardcoded Security Constants based on 2 Shoulder detection rules.

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()
  

Key Practices

  • Use environment variables
  • configurable via environment variables
4 Warning Signs
4 Warning Signs

What to watch for in code reviews

These patterns indicate potential Use of Hard-coded, Security-relevant Constants vulnerabilities. Look for these during code reviews and security audits.

🔵
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
🔍

Scan your codebase for Use of Hard-coded, Security-relevant Constants

Shoulder CLI finds vulnerable patterns across your entire codebase.