This is the Code of Canon Law re confession:
Can. 982 A person who confesses to having falsely denounced to ecclesiastical authority a confessor innocent of the crime of solicitation to a sin against the sixth commandment of the Decalogue, is not to be absolved unless that person has first formally withdrawn the false denunciation and is prepared to make good whatever harm may have been done.
Can. 983 §1 The sacramental seal is inviolable. Accordingly, it is absolutely wrong for a confessor in any way to betray the penitent, for any reason whatsoever, whether by word or in any other fashion.
§2 An interpreter, if there is one, is also obliged to observe this secret, as are all others who in any way whatever have come to a knowledge of sins from a confession.
Can. 984 §1 The confessor is wholly forbidden to use knowledge acquired in confession to the detriment of the penitent, even when all danger of disclosure is excluded.
§2 A person who is in authority may not in any way, for the purpose of external governance, use knowledge about sins which has at any time come to him from the hearing of confession.
Cont’d