I’d say “s’aventurer en terrain dangereux” (literally : to venture into a risky place)
The potential danger is seen by the locutor, but not always by the one who is doing the action
The action can be a risky conversation, a business operation, … but i won’t use it for something like jumping over a cliff. The expression is used for insidious risks, often social risks.
Besides “Jouer avec le feu” which was mentionned in many comments, I would propose:
C’est comme jouer à la roulette russe
this clearly conveys a great risk (while “jouer avec le feu” is more neutral)
I can’t think of another very idiomatic expression like this, but from there your creativity is the only limit, like in any other language…