3 ms·
You should parse the file by running it.
by amelius 10y ago
You should parse the file by running it.
- scrollaway 10y agoI'd expect any developer worth their salt to know why that's a bad idea - or are we still parsing json using eval()?
- piqufoh 10y agoThat sounds like a terrible idea - especially if you don't know if you can trust the source of the file.
- dismantlethesun 10y agoInstallation files by default are run. If you have a normal Python module sitting on PyPi, and install it it may run a setup.py which could potentially do anything that your currently active user is allowed to do. Adding custom programming logic into the requirements' file isn't really an issue, when setup.py could already grab a C compiler and start binding in system libraries into its package.
- scrollaway 10y agoYou're missing the forest for the trees. My point was that you're losing flexibility when you're not able to parse/generate a data-driven file using a well-known data format. And unless you're using a homoiconic format, code is not (easily) parsable as data.