"De Mattei: When public correction of a pope is urgent and necessary" (Rorate Caeli, February 22, 2017). Excerpt:
At Antioch, St. Peter showed profound humility, St. Paul ardent charity. The Apostle to the Gentiles showed that he was not only just but [also] merciful. Among the works of spiritual mercy there is the correction of sinners, called by moralists “fraternal correction”. It is private if the sin is private and public if the sin is public. Jesus Himself established the manner: “But if thy brother shall offend against thee, go, and rebuke him between thee and him alone. If he shall hear thee, thou shalt gain thy brother. And if he will not hear thee, take with thee one or two more: that in the mouth of two or three witnesses every word may stand. And if he will not hear them: tell the church. And if he will not hear the church, let him be to thee as the heathen and publican. Amen I say to you, whatsoever you shall bind upon earth, shall be bound also in heaven; and whatsoever you shall loose upon earth, shall be loosed also in heaven. (Mat. 18, 15-18).”[Hat tip to E. Echeverria]
We can imagine [then] that after having tried to convince St. Peter privately, Paul did not hesitate in admonishing him publically, but – says St. Thomas – “since St. Peter had sinned in front of everyone, he had to be reproached in front of everyone” (In 4 Sententiarum, Dist. 19, q. 2, a. 3, tr. it., ESD, Bologna 1999).