0

I'm working on a web service that accepts STL files, does some simple processing on them (count facets, calculate total volume, etc) and returns some stats to users. There's no database or persistence planned (although that might be added at some point in the future.) Users can either upload files or point to a URL.

What should I be thinking about in order to sanitize use input and secure the Tornado server?

Am I missing anything obvious?

Community
  • 1
  • 1
LiavK
  • 702
  • 6
  • 20
  • 1
    I think you are using the phrase STL to mean something other than what you think it means. Take a look at the tag you added to your post. – Eric Urban Aug 31 '13 at 02:49
  • Yes, sorry, I work with STL files in CAD applications all the time, keep forgetting there are other meanings. Tag removed. – LiavK Aug 31 '13 at 03:07
  • You'll need to show us an example of what an STL file is in a CAD application then. – Eric Urban Aug 31 '13 at 03:09
  • STL format can either be binary or acii. Binary is just a long list of floats. It looks like: 0000 0000 803f 0000 2041 0000 0000 0000 2041 0000 0000 0000 2041 0000 2041 0000 0000 0000 0000 0000 2041 0000 0000 803f I'm parsing it with struct.unpack, which seems like it should be sufficient to scrub it, as far as I can tell. Ascii format looks like this: facet normal ni nj nk outer loop vertex v1x v1y v1z vertex v2x v2y v2z vertex v3x v3y v3z endloop endfacet http://en.wikipedia.org/wiki/STL_(file_format) – LiavK Aug 31 '13 at 03:28
  • Sorry, I'm not sure why the code there wasn't formatted correctly -- I indented it. – LiavK Aug 31 '13 at 03:34
  • One thing that pops in my head: 1) Configuring your web server to limit max upload size 2) (Optional for beginning) Configuring your web server to have some generous rate limits. Both of these are to prevent a user from overloading your system (denial of service). – Foon Aug 31 '13 at 13:43
  • @Foon Good advice. These apply to any web service. I think the OP should do some reading on best practices for security in a web service. – Eric Urban Aug 31 '13 at 16:01

1 Answers1

0

Without you giving the code, all we can do is to speculate:

  1. Think about the boundary conditions while converting between representations (binary -> float, ascii -> binary)
  2. Think about the consequent stats calculated which will be rendered in a web browser? Is it possible to print some UTF-8 code, or is it possible to insert javascript?
onur güngör
  • 715
  • 5
  • 18