The Speech and Debate Clause of the Constitution. As long as he's "legislating", which is very broad, he's immune to lawsuit.