azohra / SlackDB

A key/value database courtesy of Slack 🙃
MIT License
13 stars 0 forks source link

Screen values before posting through the API #2

Open dishonesthips opened 5 years ago

dishonesthips commented 5 years ago

Currently, SlackDB doesn't guard against its users fucking themselves over by posting values that match the key schema. Unlike when regular users do this through their Slack client, values posted through SlackDB will appear under the name of the bot user. As a result, when SlackDB searches for a key with the only_bot? flag set, it will confuse itself into thinking a thread value is actually a key (if it matches the schema).

We should screen all values passed into the functions create\6, update\4, and append\4 and return an error if any element of the list matches the key schema (specified by the regex attribute @key_schema)