security: sanitize sort direction going into search

@rogerneel @ahuth @shirish-pampoorickal appreciate a review.