cloudsmith/geppetto — Issue #253: Improve expression validation (esp. expr - expr)
Author: hlindberg
Created: 2011-12-18 01:46:16+00:00
State: open

Expression like expr - expr, expr + expr, etc. do not have any validation rule, and happily accept all sorts of weird left/right expressions.

I believe that math operators +-*/ etc. only operate on numerical data. It is not possible to determine if dynamic expressions evaluate to numerical strings, but several cases exist where it is possible to check the validity.

a - b

is one such expression, where the operands are literal.

The - operator is especially important as an extra space in ${a-b} (i.e. ${a -b} changes the expression from a faulty variable name, to an (erroneously) accepted subtraction.