From: Rabbi Moshe Sofer
To: Unknown recipient
A man who signed a get later admitted in beis din to having fathered a child with an unmarried woman, raising the question of whether his self-incrimination retroactively disqualified him as a witness. The Chasam Sofer rules the get remains valid on the principle of ein adam meisim atzmo rasha — a person cannot disqualify himself through his own testimony, as he is considered a relative to himself. He further argues that either his repentance is genuine, validating his earlier testimony, or his confession is unreliable, in which case no disqualification applies; however, he rules the man should not serve as a get witness going forward until his repentance is verified.
Source: Shu"t Chasam Sofer EH II §115