That's the essential point. The desktop files saved should be data, that make requests of program interpreter's installed out of band. Then you need to have those data interpreters not have embedded script facilities within them, or ways to execute binary code in the data file.
Unfortunately it seems to be very tempting, to add "kool" dynamic content, by using over-general languages because it ticks the maximum number of feature lists.