ImperialCollegeLondon / Faraday-liionsden

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Secure data files upload #7

Closed dalonsoa closed 2 years ago

dalonsoa commented 3 years ago

Currently, a file of arbitrary type can be uploaded into the database, which represents a significant risk. In this task, the existing file upload form within the Django admin site will be modified such that only files fulfilling a very restricted set of conditions – extension, MIME type, etc. – related with known experimental data formats used when measuring batteries will be allowed into the system.

The existing parsers (for Biologic and Maccor file formats) will be used to extract relevant data from the files, but new ones could be added later on (see Milestone 2.3).

dalonsoa commented 3 years ago

This post in StackOverflow - and in particular this comment - cover pretty much all the code we need. The only different is that the valid extensions and valid MIME types will be provided dynamically by the parsers that are available, rather than being hardcoded as in the examples.