Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow formatting of certificates that contain \r
If an idp_cert contains a '\r' it can blow up upon response validation with `OpenSSL::X509::CertificateError: nested asn1 error` even if the cert is otherwise valid (or would have been post-formatting). From the way `OneLogin::RubySaml::Utils.format_cert` is implemented it would appear that it *is* expected for '\r's to be present since it tries to strip them appropriately during the formatting below the guard statement. Unfortunately, the guard statement at the top short circuits the formatter when certificates contain '\r' since: ``` irb:0> "asldfkj\r".match(/\x0d/) => #<MatchData "\r"> ``` Removing the `cert.match(/\x0d/)` doesn't actually break any specs but from the comment it seems that it may have been intended to ensure that encoded certs (i.e. .der) are not run through the formatter. I've added a `.der` cert to `tests/certificates` and asserted that it isn't changed when run through `format_cert` by checking for `ascii_only?`.
- Loading branch information