basho/riak_core — pull request #562 by macintux (2014-03-21 05:36:07+00:00)
Title: Be more rigorous with security command-line arguments

* Remove upper-case requirements on grant command
* Lower-case (at least for Latin-1 character set) all user/group names
* Restrict names from containing control characters, whitespace, most latin1 punctuation
* Block creation of names that would conflict with grant syntax
* Make `riak_core_console:grant/1` (and `revoke`) easier to read/modify by extracting common logic to `grant_int`
* Stop converting names to binary in `riak_core_console` so we can centrally apply lower-case, unicode conversions in `riak_core_security`
* Allow unicode names, render unicode output properly
* Catch and interpret badarg exception when a character outside latin1 space is specified as part of a source name (atoms won't allow unicode until R18)
* Lower-case all keys in options
* Be explicit with `unicode:characters_to_binary` at @jrwest's suggestion: we're converting from utf8 lists to utf8 binaries, so use the 3-ary version
* Convert (potentially utf-8) error messages from `check_permissions` to binary so the protocol buffers stack doesn't choke on them

Several other PRs are necessary to complete this:
* basho/riak_ee#229
* basho/riak#513
* basho/riak_test#555
* basho/riak_kv#874
* basho/node_package#119

Also related:
* #556 (prevent `any` from being used as a bucket type name, conflicting with granting permissions)

Should be able to be closed without merging if this goes through first:
* #558

/cc @Vagabond @jrwest