New York Real Property Actions & Proceedings Law
1. In an action brought under this article, the person in possession shall be made a party to the action, and when such person claims the right of possession, or an interest in the real property, under another, such other person shall also be made a party.
2. Where it appears to the court that a person not a party to the action may have an estate or interest in the real property which may in any manner be affected by the judgment, the court, upon application of such person, or of any party to the action, or on its own motion, may direct that such person be made a party.