Actually, no, the big book is very explicit that you should not confess when it would harm others... that's why the ninth step reads made direct amends to such people whenever possible EXCEPT WHEN TO DO SO WOULD INJURE THEM OR OTHERS...
Part of that was quite explicitly a get-out clause so Bill W. wouldn't have to reveal his numerous mistresses (one of whom actually still, or her descendents) gets royalties from the big book, to his wife, but it's a valid principle whatever its roots.
it's discussed in the step in the big book and 12 and 12, i think-- with explicit reference to adulterous affairs.