Renters get at least 90 days' notice after a foreclosure
12 U.S.C. § 5220 note(Pub. L. 111-22, div. A, § 702(a)–(b))
If you rent a home that goes through foreclosure, the new owner must give you a notice to move at least 90 days before you have to leave. If you have a real (bona fide) lease signed before the foreclosure notice, you can usually stay until the lease ends. The exception is when the new owner will live in the home; even then you still get the 90 days' notice.
Read this right