The installer currently uses math/rand for generating security-sensitive data, which is a significant security risk.
Identified Problems:
- Insecure Randomness: In
utils/secret.go, math/rand is used to generate passwords and internal keys. math/rand is a deterministic pseudo-random number generator and is not suitable for cryptographic or security purposes.
- Predictability: Secrets generated this way can potentially be predicted if the seed is known or guessed.
Affected Code:
installer/utils/secret.go: GenerateSecret function.
installer/config/config.go: Usage of utils.GenerateSecret for default passwords and internal keys.
Recommended Actions:
- Replace
math/rand with crypto/rand for all secret and key generation.
- Ensure proper error handling when reading from
crypto/rand.