Framework for specifying and enforcing rules on key/value pairs