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

SSLContext::authenticate peer name validation doesn't work #1088

Open
jmccl opened this issue Mar 27, 2019 · 5 comments
Open

SSLContext::authenticate peer name validation doesn't work #1088

jmccl opened this issue Mar 27, 2019 · 5 comments

Comments

@jmccl
Copy link
Contributor

jmccl commented Mar 27, 2019

The 'peerName' parameter sets the 'peerFixedName_' member, which is unused.

@yfeldblum
Copy link
Contributor

It is returned in SSLContext::peerFixedName().

@jmccl
Copy link
Contributor Author

jmccl commented Mar 28, 2019

The comment on the authenticate method is:

@param peerName If non-empty, validate that the certificate common
name of peer matches the given string (altername
name(s) are not used in this case).

This does not occur. Yes, one can access the member via the method you reference, but that's not the extent of what the documentation suggests.

I can re-submit, or you can re-open if you prefer.

@yfeldblum
Copy link
Contributor

@djwatson @ngoyal

@yfeldblum yfeldblum reopened this Mar 28, 2019
@ngoyal
Copy link
Contributor

ngoyal commented Mar 29, 2019

I'm tempted to remove this parameter. Any objections? This can be done by adding a handshake verifier on the AsyncSSLSocket.

It doesn't appear that checkPeerName is used anywhere either, but can be for logging from the application I guess.

@jmccl
Copy link
Contributor Author

jmccl commented Mar 29, 2019

I think that makes sense, fwiw. It looks like a signature and comment got out ahead of an implementation that never happened.

If you’re going to change the signature you might want to consider removing the second parameter (‘checkPeerName’) as well. It appears to be similarly unused. The only downside I can see is it will break compilation of the wangle client SSL example code.

https://github.com/facebook/wangle/blob/be6d5481fed1e35fab15853f1315d5eebcac0ff7/wangle/example/ssl/Client.cpp#L109

Cleaning the meaningless ‘bool’ up is probably a good thing though.

I have one last observation, which is that the interaction between ‘authenticate’ and ‘setVerificationMode’ isn’t clear, at least to me. My reading of the code is that ‘setVerificationMode’ overrides the ‘authenticate’ behavior only if the SSLContext user (such as AsyncSSLSocket) is properly coded; otherwise the ‘authenticate’ behavior is used. But I could easily be misreading what’s going on. If the interaction happens to be obvious to you updating the comments would be appreciated.

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

No branches or pull requests

3 participants