ספר המדות, A Righteous Person / Part I A Righteous Person / Part I · קיד
Sefer HaMiddot 2125
קיד. כְּשֶׁרָשָׁע עוֹשֶׂה אֵיזֶה רָעָה וּבָא לְהַצַּדִּיק וְשׁוֹאֵל מִמֶּנּוּ אִם יָפֶה עָשָׂה, מֻתָּר לוֹמַר לוֹ: יָפֶה עָשִׂיתָ, כְּדֵי לְהַצִּיל אֶת נַפְשׁוֹ.
114. When a wicked man does some evil, and comes to the Tzaddik and asks him if what he (the wicked mad) did was acceptable, it is permissible (for the Tzaddik) to tell him, "You did well", in order to save himself (lit. his soul).