The bug does not affect Apple’s Messages app, but for third party messaging apps like WhatsApp, Skype or Telegram, Siri will read out these notifications on your lockscreen, even if your privacy settings for ‘Show Previews’ is set to display only ‘When Unlocked’ (Settings > Notifications > Show Previews).
On iPhone X for example, the default is set to ‘When Unlocked’, which means messages on the lockscreen are hidden unless you glance at your screen for Face ID. But Siri can read out messages, even with this setting set to ‘When Unlocked’, which can be a privacy faux pas, since anyone will be able to hear your messages.
According to Mac Magazine, the bug works in iOS 11.2.6 and iOS 11.3 beta as well; Apple has been made aware of the bug.
Update March 22, 2018: Apple has confirmed the bug will be fixed in an upcoming iOS update, in a statement to MacRumors:
“We are aware of the issue and it will be addressed in an upcoming software update.”