Add security checks to BlockAndGetFileReferences