Introduced with iOS 11.4, the feature uses end-to-end encryption and stores iMessages and text messages in the cloud, freeing up space on your device.
However, it’s important to note that if you have the iCloud Backup function turned on, your backup will also include a copy of the key used for decrypting your messages.
The fact that Apple stores the key in iCloud Backup is not a security issue in itself, since this is to ensure that users can recover their messages if they lose their device. However, authorities in some countries could require Apple to release the backup, which may give them access to the key for decrypting the messages.
For that reason you may want to disable your phone’s iCloud Backup and save the data locally on your computer using a cable and a program like iTunes or iMazing.
This way the decryption key will be kept on your computer. In this case, third parties would need to have access to the computer in order to get the key. — dpa