(#23369) Handle invalid csr attributes

Updates the code that loads csr attributes to handle empty files and unexpected YAML content