"The warden of the prison did not see anything in his hand, because the LORD was with him" (Genesis 39:23). Until now [we have learned this] in a time of distress; and from where do we know it was so even in a time of ease? Scripture teaches, "And all that he did the LORD made to prosper in his hand" (above, verse 3).
The Warden Saw Nothing Because the Lord Was With Joseph
Yalkut Shimoni on Torah 146:5
(בראשית לט כג) אֵין שַׂר בֵּית הַסֹּהַר רֹאֶה אֶת כָּל מְאוּמָה בְּיָדוֹ בַּאֲשֶׁר ה' אִתּוֹ. עַד עַכְשָׁו בִּשְׁעַת צָרָה, וּמִנַּיִן אַף בִּשְׁעַת הַרְוָחָה, תַּלְמוּד לוֹמַר (לעיל פסוק ג) "וְכֹל אֲשֶׁר הוּא עֹשֶׂה ה' מַצְלִיחַ בְּיָדוֹ".