The foam holds it very solidly. No way will it fall out even with a rugby team pushing on it. That said it isn’t UV stable or rodent proof so extra fixings can be prudent. Most modern doors have brackets that slot in rather than having to drill right through the frame. They are so easy to fit that you might as well.
As waswas says it is technically a building regs matter. They won’t actually do anything but it might get flagged up when you sell the house. No idea why you can fit floors, build walls, replace electrics and plumbing all by yourself but need someone checking up if you try and fit a window.