My mind goes wandering with this question ... and I thank you for asking it.
Secrets are an interesting matter. On one hand, the Bible speaks of the importance of keeping secrets ...
Proverbs 11:13 A talebearer reveals secrets: but he that is of a faithful spirit conceals the matter.
Proverbs 20:19 He that goes about as a talebearer reveals secrets: therefore meddle not with him that flatters with his lips.
But I am pretty sure the secrets spoken of here are the ones entrusted to you that are not sinful to keep.
Secrets that are good to keep are those that are fairly entrusted ... truths that belong to the teller that are being entrusted to you to enter into a deeper understanding of their world ... these may bring joy ... or not ... but they are not negligent to keep.
Secrets that are wrong to keep are those that are unfairly entrusted ... truths that need to be known because the person is using the secret as a shield to do wrong, whether to others or to themselves. Those types of secrets do harm to those who keep them trying to protect those who want to continue doing what they are doing without being caught or stopped.
Examples of secrets you are negligent to keep include but are not limited to suicidal or any self harm thoughts or tendencies, murderous thoughts, kidnappings, any violent tendencies, any violent criminal behavior, any sexually criminal tendencies or behaviors, robbery and thievery ... and the list goes on.
I have heard speakers teach that no secrets should be held between husband and wife. I cannot agree with that. Some information in my wife's head that she has been told in confidence I don't want to know ... I don't. And I really have to doubt the intelligence of anyone who thinks they need to know everything about everyone in their spouse's world. Information always has a price .. it does. So I think there are healthy reasons to keep secrets within a marriage. But I also believe that, as will most things, the key is balance.
When I read this question, what comes to my mind is that someone has either been caught in an affair or someone has approached a spouse, knowing the other spouse, yet still soliciting an adulterous relationship. I also recognize that there are a zillion other possibilities but since we're being vague and I'm being honest ... that's what comes to mind.
It is my opinion that a healthy marriage can weather any storm ... and if someone has solicited my wife, though it will anger me, she can let me know and through the candor of our relationship keep me from the prison sentence and them from finding themselves stuck in a pig's stomach somewhere.
It is my opinion that a person who is caught in an affair needs to make a decision. I am not arrogant enough to mark every person who steps outside of their marriage as an animal ... there are some marriages that are the closest thing to hell a person will ever experience ... and my heart goes out to them. But I think that if it has got to that point decisions must be made.
I cannot say that I would demand they tell their spouse or I would in that case ... but in other cases I have in times past told a person who entrusted information to me that they shouldn't have that they had till a certain time the next day to come clean or I was going to call ... and that I was going to call .. and that I did call. In some cases it was coming clean to their spouse, yet in others it was coming clean to a licensed counselor who specializes in sexual issues ... I do not ... nor do I want to.
I have also in times past counseled people not to inform their spouse ... to get it right before the Lord .. and die with it ... some spouses are not able to shoulder that info ... and if the reason for dumping it on them is to clear a conscience, then that is just absurd.
Now it comes to you, the questioner as a person. One of the most important questions to ask yourself is how this knowledge is truly effecting you. If it is hurting you, you are not sworn by God to carry another person's failures, nor your own. At a minimum, give it to Him. Remember ...
1Pe 5:6-7 Humble yourselves therefore under the mighty hand of God, that He may exalt you in due time: 7 Casting all your care upon Him; for He cares for you.
Also consider that we are not expected to keep foolish oaths (remember King Saul's foolish oath and how it affected Jonathan his son (1 Samuel 14). If we make an oath in err ... confess and repent and tell the truth. If someone you love may react wrong, get out in front of it. Prepare vs repair ...
Also consider that God Himself promises that He will make sure that some secrets are made public ...
Psalms 44:21 Shall not God search this out? For He knows the secrets of the heart.
Daniel 2:28 But there is a God in heaven that reveals secrets ...
Numbers 32:23 ... take note, you have sinned against the LORD; and be sure your sin will find you out.
But that's His business. If God is exposing a matter, we don't want to be in His way ... that will not end well for us. We can never protect people from the consequences of their actions when God is rooting them out.
If this secret gets found out anyways, how will you look? If someone has put you in a position to lie ... to shield ... to hide a matter ... where will that person be when the wall falls around you? Often times, the collateral damage falls on the head of the secret keeper ... trust is damaged ... reputation hurt. I don't know if it's worth what it will cost you if you've done nothing wrong.
However, if you are involved, then there is good counsel on both sides ... coming clean and letting it die with you. I unfortunately, without knowing more detail, cannot suggest one or the other.
I do know this: I have secrets that I will carry to my grave ... mostly involving others ... it is what I feel to be right and best. Much of that information would cause grave damage to the people who have entrusted them to me ... but in all situations I demanded they get their heads on right.
As per my life I try to be as transparent as I can be ... leaves nothing to blackmail. Still yet, there are secrets that will go to my grave ... God knows all ... and if He were to lead me to share them, I would ... but that has not happened. Don't try to be too imaginative, my secrets would probably cause yawns ... anything I have done wrong, I have opened up and told on myself ... most of my secrets involve reactions, thoughts, dreams, and hopes I have. They are mine .. they will stay that way.
So to wrap it up, I think you need to be honest with yourself about whether this secret qualifies as one worth keeping, what keeping this secret is costing you, what it may yet cost you, and whether or not you are able to deal with it. Perhaps it's not even you ... maybe you're looking to counsel a friend ... the rules don't change.