mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
fix: cherry pick security issue fixes (#1432)
* fix: potential "Potentially unsafe external link" of TOS and EMail Links * fix: "Size computation for allocation may overflow" by limiting aes encrypt to 64MB
This commit is contained in:
@@ -92,6 +92,10 @@ func EncryptAES(plainText []byte, key string) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
maxSize := 64 * 1024 * 1024
|
||||
if len(plainText) > maxSize {
|
||||
return nil, errors.ThrowPreconditionFailedf(nil, "CRYPT-AGg4t3", "data too large, max bytes: %v", maxSize)
|
||||
}
|
||||
cipherText := make([]byte, aes.BlockSize+len(plainText))
|
||||
iv := cipherText[:aes.BlockSize]
|
||||
if _, err = io.ReadFull(rand.Reader, iv); err != nil {
|
||||
|
Reference in New Issue
Block a user