conjurinc/cli-ruby — pull request #54 by dividedmind (2014-06-02 20:12:09+00:00)
Title: ERB security fix

Currently `env:template` allows not only inspecting internal data structure but also full system access. This is not very problematic since templates are expected to come from and be used in a trusted environment, but it still allows doing some funny stuff either by accident or disgruntled malice.

This patch makes the templates run in a clean execution environment instead, with a $SAFE level of 3 to prevent dangerous OS calls.

We can also add a method_missing in the context to make it unnecessary to use the reduntant `conjurenv[]` with template variables.

(Actually why aren't we using some dead-simple template language instead, like `conjurenv.each {|k, v| template['{%s}' % k] = v}`?)