Add hook to allow users to validate libraries

/cc @mlubin