Describe the bug
In pgp/yubikey.go line 96, MIME boundary uses only time.Now().Unix() which is predictable and not cryptographically secure. While crypto/rand is used in sender.go, yubikey.go has weaker fallback.
To reproduce
Examine pgp/yubikey.go line 96:
boundary := fmt.Sprintf("----=_Part_%d", time.Now().Unix())
Compare to sender/sender.go lines 81, 283, 487 which use crypto/rand properly.
Expected behavior
Use crypto/rand for MIME boundaries to prevent prediction attacks.
Additional context
- Good first issue
- Low severity (MIME boundary prediction has limited attack surface)
- Best practice: always use crypto/rand for boundaries
- sender/sender.go shows correct pattern
Suggested fix:
buf := make([]byte, 16)
if _, err := rand.Read(buf); err == nil {
boundary = fmt.Sprintf("----=_Part_%x", buf)
} else {
// fallback
boundary = fmt.Sprintf("----=_Part_%d", time.Now().UnixNano())
}
OS
All platforms
Describe the bug
In pgp/yubikey.go line 96, MIME boundary uses only time.Now().Unix() which is predictable and not cryptographically secure. While crypto/rand is used in sender.go, yubikey.go has weaker fallback.
To reproduce
Examine pgp/yubikey.go line 96:
Compare to sender/sender.go lines 81, 283, 487 which use crypto/rand properly.
Expected behavior
Use crypto/rand for MIME boundaries to prevent prediction attacks.
Additional context
Suggested fix:
OS
All platforms