Priests, religious, Tradland, listen up. You are bound to reject unjust acts, even should they come from LEGITIMATE authority. How much more does this apply to unjust acts from illegitimate authority. You need to do this, either way. Aquinas explains:
“Obedience is not a theological virtue, for its direct object is not God, but the precept of any superior, whether expressed or inferred, namely, a simple word of the superior, indicating his will, and which the obedient subject obeys promptly, according to Titus 3:1, “Admonish them to be subject to princes, and to obey at a word,” etc. It is, however, a moral virtue, since it is a part of justice, and it observes the mean between excess and deficiency. Excess thereof is measured in respect, not of quantity, but of other circumstances, in so far as a man obeys either whom he ought not, or in matters wherein he ought not to obey, as we have stated above regarding religion (II-II:92:2).”
Article 5. Whether subjects are bound to obey their superiors in all things?
Objection 1. It seems that subjects are bound to obey their superiors in all things. For the Apostle says (Colossians 3:20): “Children, obey your parents in all things,” and farther on (Colossians 3:22): “Servants, obey in all things your masters according to the flesh.” Therefore in like manner other subjects are bound to obey their superiors in all things.
Objection 2. Further, superiors stand between God and their subjects, according to Deuteronomy 5:5, “I was the mediator and stood between the Lord and you at that time, to show you His words.” Now there is no going from extreme to extreme, except through that which stands between. Therefore the commands of a superior must be esteemed the commands of God, wherefore the Apostle says (Galatians 4:14): “You . . . received me as an angel of God, even as Christ Jesus” and (1 Thessalonians 2:13): “When you had received of us the word of the hearing of God, you received it, not as the word of men, but, as it is indeed, the word of God.” Therefore as man is bound to obey God in all things, so is he bound to obey his superiors.
Objection 3. Further, just as religious in making their profession take vows of chastity and poverty, so do they also vow obedience. Now a religious is bound to observe chastity and poverty in all things. Therefore he is also bound to obey in all things.
On the contrary, It is written (Acts 5:29): “We ought to obey God rather than men.” Now sometimes the things commanded by a superior are against God. Therefore superiors are not to be obeyed in all things.
I answer that, As stated above (Articles 1 and 4), he who obeys is moved at the bidding of the person who commands him, by a certain necessity of justice, even as a natural thing is moved through the power of its mover by a natural necessity. That a natural thing be not moved by its mover, may happen in two ways. First, on account of a hindrance arising from the stronger power of some other mover; thus wood is not burnt by fire if a stronger force of water intervene. Secondly, through lack of order in the movable with regard to its mover, since, though it is subject to the latter’s action in one respect, yet it is not subject thereto in every respect. Thus, a humor is sometimes subject to the action of heat, as regards being heated, but not as regards being dried up or consumed. On like manner there are two reasons, for which a subject may not be bound to obey his superior in all things. First on account of the command of a higher power. For as a gloss says on Romans 13:2, “They that resist [Vulgate: ‘He that resisteth’] the power, resist the ordinance of God” (cf. St. Augustine, De Verb. Dom. viii). “If a commissioner issue an order, are you to comply, if it is contrary to the bidding of the proconsul? Again if the proconsul command one thing, and the emperor another, will you hesitate, to disregard the former and serve the latter? Therefore if the emperor commands one thing and God another, you must disregard the former and obey God.” Secondly, a subject is not bound to obey his superior if the latter command him to do something wherein he is not subject to him. For Seneca says (De Beneficiis iii): “It is wrong to suppose that slavery falls upon the whole man: for the better part of him is excepted.” His body is subjected and assigned to his master but his soul is his own. Consequently in matters touching the internal movement of the will man is not bound to obey his fellow-man, but God alone.
Nevertheless man is bound to obey his fellow-man in things that have to be done externally by means of the body: and yet, since by nature all men are equal, he is not bound to obey another man in matters touching the nature of the body, for instance in those relating to the support of his body or the begetting of his children. Wherefore servants are not bound to obey their masters, nor children their parents, in the question of contracting marriage or of remaining in the state of virginity or the like. But in matters concerning the disposal of actions and human affairs, a subject is bound to obey his superior within the sphere of his authority; for instance a soldier must obey his general in matters relating to war, a servant his master in matters touching the execution of the duties of his service, a son his father in matters relating to the conduct of his life and the care of the household; and so forth.
Reply to Objection 1. When the Apostle says “in all things,” he refers to matters within the sphere of a father’s or master’s authority.
Reply to Objection 2. Man is subject to God simply as regards all things, both internal and external, wherefore he is bound to obey Him in all things. On the other hand, inferiors are not subject to their superiors in all things, but only in certain things and in a particular way, in respect of which the superior stands between God and his subjects, whereas in respect of other matters the subject is immediately under God, by Whom he is taught either by the natural or by the written law.
Reply to Objection 3. Religious profess obedience as to the regular mode of life, in respect of which they are subject to their superiors: wherefore they are bound to obey in those matters only which may belong to the regular mode of life, and this obedience suffices for salvation. If they be willing to obey even in other matters, this will belong to the superabundance of perfection; provided, however, such things be not contrary to God or to the rule they profess, for obedience in this case would be unlawful.
Accordingly we may distinguish a threefold obedience; one, sufficient for salvation, and consisting in obeying when one is bound to obey: secondly, perfect obedience, which obeys in all things lawful: thirdly, indiscreet obedience, which obeys even in matters unlawful.
ST II-II Q104 https://www.newadvent.org/summa/3104.htm