added validation and sanitizing functions for mitigating RCE vulnerabilities

works in conjunction with https://github.com/opentechinstitute/luci-commotion-apps/pull/21 (see for testing instructions)

part of fix for https://github.com/opentechinstitute/luci-commotion-apps/issues/10, https://github.com/opentechinstitute/luci-commotion-apps/issues/11, https://github.com/opentechinstitute/luci-commotion-apps/issues/13

<!---
@huboard:{"order":23.25}
-->