Not knowing what the adventure is, I can say you've fallen into the Leomunds Tiny Hut problem. Using LTH in dangerous territory is a stopgap measure, not an automatic success. If they attempt to rest in a hostile area, have someone notice them, who then reports it. After the first time they do this, they watch in horror as an army of bad guys camp outside the hut waiting for it to end. Theoretically they could cast it again before it falls, but unless they can teleport, they'll either run out of supplies or time. If the party can teleport, the next time there's a caster who simply dispels the hut before they finish the rest (they can't counterspell from within). The fight should be in the Deadly category, but just so. If the party doesn't learn their lesson from this, the next time is almost twice as hard. The players should hopefully get the hint.
We're playing BGDiA, and we use LTH for long rests. However, we also seek out secluded areas where we could naturally hide. LTH is the backup plan, not the primary one. One time we were forced to rest in a lair using LTH, and obviously a trap was laid for us. After the trap we were actually worse off than we were before the long rest! You only rest when you can or when you must, otherwise bad stuff can (and probably will) happen.
EDIT: @Oofta you already can't cast spells out of it, per the spell description.
We're playing BGDiA, and we use LTH for long rests. However, we also seek out secluded areas where we could naturally hide. LTH is the backup plan, not the primary one. One time we were forced to rest in a lair using LTH, and obviously a trap was laid for us. After the trap we were actually worse off than we were before the long rest! You only rest when you can or when you must, otherwise bad stuff can (and probably will) happen.
EDIT: @Oofta you already can't cast spells out of it, per the spell description.