Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CA cert regexp #609

Merged
merged 1 commit into from
Apr 18, 2021
Merged

Fix CA cert regexp #609

merged 1 commit into from
Apr 18, 2021

Conversation

sharshenov
Copy link
Contributor

The regex /^([a-z]:?)?\//i introduced in 334e98c is intended to pick Windows file paths (C:/whatever).
But ^ matcher stands for "start of line", which leads to false-positive matches when inline certificate has a char with slash at the begginning of a some line.

Certs like this one

-----BEGIN CERTIFICATE-----
whatever
U/whatever
whatever
-----END CERTIFICATE-----

are treated as a file path.

As result Bunny is unable to connect to the RMQ server with self signed certificate and prints an error:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate in certificate chain)

A regexp matcher \A stands for "Start of string" and resolves false-positive match.

The regex `/^([a-z]:?)?\//i` introduced in 334e98c is intended to pick Windows file paths (`C:/whatever`).
But `^` matcher stands for "start of line", which leads to false-positive matches when inline certificate has a char with slash at the begginning of a some line.

Certs like this one
```
-----BEGIN CERTIFICATE-----
whatever
U/whatever
whatever
-----END CERTIFICATE-----
```
are treated as a file path.

As result Bunny is unable to connect to the RMQ server with self signed certificate and prints an error:

```
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate in certificate chain)
```

A regexp matcher `\A` stands for "Start of string" and resolves false-positive match.
@michaelklishin michaelklishin merged commit cfde49b into ruby-amqp:master Apr 18, 2021
@sharshenov sharshenov deleted the fix-ca-cert-regexp branch April 18, 2021 17:39
sharshenov added a commit to sharshenov/bunny that referenced this pull request Apr 18, 2021
Hey @michaelklishin,
I mixed up specs descriptions in ruby-amqp#609.
Sorry, I discovered the mistake only after the PR is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants