You can let a character make any kind of foolish decision or take any kind of dangerous action if you give them a good enough reason for the reader to feel as if they might have done the same thing in the given circumstances.
In a nutshell, to coin a cliche, that is motivation.
Good characters keep secrets, tell lies, and take risks for good reasons. Bad characters keep secrets, tell lies, and take risks, for bad reasons. But they all have a reason to keep secrets, take risks, and tell lies.
That reason is the character’s motivation. One reason writers of romantic suspense get criticized is because the dimwit heroine always goes blindly into the house filled with weird characters and murderers determined to solve the mystery herself, when any sane person would go away and call the police. Of course if her sister or child were inside and in danger, then she might have the proper motivation.