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

Weak Password Requirements

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

Weak Password Requirements

The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts.

Without strong password requirements, users often choose weak, easily guessable passwords. This makes brute-force and dictionary attacks more likely to succeed.

普及度
頻繁に悪用される
影響度
ハイ
1 件の重大度ハイのルール
予防
文書化済み
2 件の修正例
2 予防
2 予防

この脆弱性の修正方法

2 件の Shoulder 検出ルールに基づく Weak Password Requirements の予防策。

Weak Password Policy MEDIUM

Enforce minimum 12-character passwords with complexity requirements

+14 -2 go
  func validatePassword(password string) error {
-     if len(password) < 6 {
-         return errors.New("too short")
+     if len(password) < 12 {
+         return errors.New("password must be at least 12 characters")
+     }
+     var hasUpper, hasLower, hasDigit, hasSpecial bool
+     for _, c := range password {
+         switch {
+         case unicode.IsUpper(c):  hasUpper = true
+         case unicode.IsLower(c):  hasLower = true
+         case unicode.IsDigit(c):  hasDigit = true
+         case unicode.IsPunct(c) || unicode.IsSymbol(c): hasSpecial = true
+         }
+     }
+     if !hasUpper || !hasLower || !hasDigit || !hasSpecial {
+         return errors.New("password must include upper, lower, digit, and special char")
      }
      return nil
  }
  
Weak Password Policy HIGH

Require minimum 12 characters with complexity checks or use a password strength library

+4 -2 javascript
- if (password.length < 6) {
-   throw new Error('Password too short');
+ const zxcvbn = require('zxcvbn');
+ 
+ if (password.length < 12 || zxcvbn(password).score < 3) {
+   throw new Error('Password too weak');
  }
  
3 検出
3 検出

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

Shoulderを使用してコードのWeak Password Requirementsパターンをスキャンしましょう。 2 ルール.

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

# Or scan entire project
npx @shoulderdev/cli trust .
4 警告サイン
4 警告サイン

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

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

🟠
Password validation at ... lacks proper complexity requirements javascript-weak-password-policy
🟠
password validation that lacks proper complexity requirements, making accounts vulnerable to brute f javascript-weak-password-policy
🔍

コードベースをスキャン: Weak Password Requirements

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