Iran has indicated they will only target ships tied to countries that are involved in the conflict.
That likely means US and Israel. Unclear if countries like the UK that are facilitating the US through use of their bases would be considered legitimate targets (likely yes).
Unfortunately Iran's leadership is in a bit of distress and communication disrupted, and "involved in the conflict" is a very broad term - so they do make some effort to get chinese oil out, but any ship not asking for explicit permission from Iran - will have some great risk of being targeted.
Remember, the strait is not Iranian property, but International waters. So no one would have to ask them for permission, but that is the way it is and most do not risk it (insurance won't cover).
That's not how mines work. They don't only explode on people you want them to explode on.