The Sacrament is effective ex opere operato --- that is, "by the work worked." Jesus gives the absolution: it is not based on the priest's merit.
One has to assume then that the priest has received a supernatural power to know whether the confessor is telling the truth...