ベータ Shoulder はベータ版です — 結果が誤っている場合があります。皆さまのフィードバックが次に修正する内容を決定します。 フィードバックを送る
📋

Insertion of Sensitive Information into Log File

🛡️ 3 件のルールが検出します

Insertion of Sensitive Information into Log File

Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information.

When sensitive information like passwords, tokens, or personal data is logged, it becomes accessible to anyone with access to the logs. Log files are often stored with less security than the data they contain.

普及度
3 言語をカバー
影響度
ハイ
1 件の重大度ハイのルール
予防
文書化済み
3 件の修正例
2 予防
2 予防

この脆弱性の修正方法

3 件の Shoulder 検出ルールに基づく Information Exposure Through Logs の予防策。

Logging Sensitive Data MEDIUM

Never log passwords, tokens, or PII; log presence/absence instead

+1 -1 go
  func authenticateUser(username, password string) error {
-     log.Printf("Auth: user=%s password=%s", username, password)
+     log.Printf("Auth attempt: user=%s", username)
      return nil
  }
  
Sensitive Data Exposure in Logs MEDIUM

Exclude sensitive fields from logged data using destructuring or redaction

+2 -1 javascript
  app.post('/login', (req, res) => {
-   console.log('Login request:', req.body);
+   const { password, ...safeBody } = req.body;
+   logger.info('Login request:', safeBody);
  });
  
Sensitive Data in Logging HIGH

Redact sensitive fields before logging; log actions and identifiers, not credentials

+1 -1 python
  import logging
  
  logger = logging.getLogger(__name__)
  
  def login(username, password):
-     logger.info(f"Login: user={username}, password={password}")
+     logger.info(f"Login attempt for user: {username}")
      authenticate(username, password)
  
3 検出
3 検出

コードの脆弱性を見つける

Shoulderを使用してコードのInsertion of Sensitive Information into Log Fileパターンをスキャンしましょう。 3 ルール.

ターミナル
# Scan with Shoulder CLI
npx @shoulderdev/cli trust --cwe=532

# Or scan entire project
npx @shoulderdev/cli trust .

検出ルール (3)

4 警告サイン
4 警告サイン

コードレビューで注目すべき点

これらのパターンはInsertion of Sensitive Information into Log Fileの潜在的な脆弱性を示しています。コードレビューとセキュリティ監査中に探してください。

🟠
logging of sensitive data like passwords, API keys, tokens, credit cards, or authentication credenti python-sensitive-data-logging
🟡
when user-provided sensitive data (passwords, tokens, API keys, secrets, etc javascript-sensitive-data-logging
🔍

コードベースをスキャン: Insertion of Sensitive Information into Log File

Shoulder CLI はコードベース全体から脆弱なパターンを見つけます。