This is a grey area. The owner has the right to lease the premises until the property goes to sale. The property will not go to sale until the later of six months after the owner is served with summons or three months after a judgment is entered. If a case is filed, that information is a public record and is available on the internet.
If the property is located in Cook County, this process could take over a year.
You should record the lease against the property. That way a short buyer would take subject to your lease.
The Answer on file for this question is well thought out and correct. I would add that Chicago has an ordinance that requires that a landlord in foreclosure must notify a tenant that they are in foreclosure proceedings and there are penalties for failure to notify.