The Messenger of Allah ﷺ said, "Beware of entering upon women."A man from the Ansar asked, "Messenger of Allah, what about the in-law?"He replied, "The in-law is death."
حدثنا حجاج أخبرنا ليث حدثني يزيد بن أبي حبيب عن أبي الخير
أن رسول الله ﷺ قال إياكم والدخول على النساء فقال رجل من الأنصار يا رسول الله أفرأيت الحمو قال الحمو الموت
Its isnad is sahih, Bukhari related it 7/48, Shab edition, in Nikah, "A man should never be alone with a woman," and Muslim in 4/1711, number 2172, in Salam, "The prohibition of being alone with an unrelated woman," and Tirmidhi in 3/465, number 1171, and he said, hasan sahih.