FLEX: A flexible code authentication framework for delegating mobile app customization