Pandavas are righteous in the following two instances.
1: Vyasa asked Pandavas to live in disguise at Ekachakra and Pandavas followed the same.
"Vyasa then said, 'Ye bulls of Bharata's race, I knew beforehand of
this affliction of yours consisting in your deceitful exile by the son
of Dhritarashtra. Knowing this, I have come to you, desirous of doing
you some great good. Do not grieve for what hath befallen you. Know
that all this is for your happiness. Undoubtedly, the sons of
Dhritarashtra and you are all equal in my eye. But men are always
partial to those who are in misfortune or of tender years. It is
therefore, that my affection for you is greater now. And in
consequence of that affection, I desire to do you good. Listen to me!
Not far off before you is a delightful town where no danger can
overtake you. Live ye there in disguise, waiting for my return.'
[Section 158, Hidimva-vadha Parva, Adi Parva, The Mahabharata]
2: Pandavas got boon from Dharma devta (Yama) that no one can recognize Pandavas even when they are in their original forms and Pandavas can take any form. Pandavas utilized the same.
Yudhishthira said,--'We have spent these twelve years in the forest;
and the thirteenth year is come. May no one recognise us, as we spend
this year somewhere.'
Vaisampayana continued,-'Thereat that worshipful one replied,--'I give
this boon unto thee!' And then reassuring Kunti's son having truth for
prowess, he also said, 'Even if, O Bharata, ye range this (entire)
earth in your proper forms none in the three worlds shall recognise
you. Ye perpetuators of the Kuru race, through my grace, ye will spend
this thirteenth year, secretly and unrecognised, in Virata's kingdom!
And every one of you will be able at will to assume any form he likes!
Do ye now present the Brahmana with his fire-sticks. It was only to
test you that I carried them away in the form of a deer! O amiable
Yudhishthira, do thou ask for another boon that thou mayst like! I
will confer it on thee. O foremost of men, I have not yet been
satisfied by granting boons to thee! Do thou my son, accept a third
boon that is great and incomparable! Thou, O king, art born of me, and
Vidura of portion or mine!" Thereat Yudhishthira said,--'It is enough
that I have beheld thee with my senses, eternal God of gods as thou
art! O father, whatever boon thou wilt confer on me I shall surely
accept gladly! May I, O lord, always conquer covetousness and folly
and anger, and may my mind be ever devoted to charity, truth, and
ascetic austerities! The Lord of justice said,--'Even by nature, O
Pandava, hast thou been endued with these qualities, for thou art the
Lord of justice himself! Do thou again attain what thou asked for!"
[Section 312, Aranya Parva, Vana Parva, The Mahabharata]
Thus, Pandavas, during the firs instance live in disguise based on the suggestion by Vyasa, who is a dharma sastra kartha and Pandavas utilized the boon of Yama, who is dharma devtha, during second instance.
Hence there is no unrighteous act from the side of Pandavas.