8000 expose verify helper functions by Fritiofhedstrom · Pull Request #1325 · rustls/rustls · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

expose verify helper functions #1325

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

Conversation

Fritiofhedstrom
Copy link

Alternative to: #1320 that makes it less easy to create a ServerCertVerifier that skips domain name verification.

I chose not to call the new public functions from the WebPkiVerifier impl block because they need to parse the Certificate to webpki::EndEntity. If I did call the new functions, then the cert would be parsed twice.

@cpu
Copy link
Member
cpu commented Jun 26, 2023

@Fritiofhedstrom It looks like your branch doesn't build. Could you take a look at fixing that (maybe also rebase on main)?

@Fritiofhedstrom Fritiofhedstrom force-pushed the any_domain_name_server_verification_option2_pub_helper_functions branch from 0f21927 to a5868f4 Compare June 27, 2023 07:22
@Fritiofhedstrom
Copy link
Author

rebased on main and adapted to new DnsName struct

use rustls::client::{
HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier, WebPkiVerifier,
};
use rustls::client::WebPkiVerifier;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unrelated? I'd rather keep all imports from the same module on the same line.

)
.map_err(pki_error)
.map(|_| cert)?;
cert.verify_is_valid_tls_server_cert(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like both this and the server name check should use the newly created functions, to avoid us having to keep them in sync manually.

Copy link
Member
@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I had a couple small comments.

10000
@Fritiofhedstrom Fritiofhedstrom force-pushed the any_domain_name_server_verification_option2_pub_helper_functions branch from 01a67ec to 408be12 Compare June 30, 2023 08:49
intermediates: &[Certificate],
now: SystemTime,
) -> Result<(), Error> {
let chain: Vec<&[u8]> = intermediates
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reuse prepare() here, maybe by changing its API a bit to fit better?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split it to seperate functions for each argument

Copy link
Member
@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it might make life a little easier for downstream verifier users while keeping things more or less the same for everyone else -- seems okay? @ctz thoughts?

8000
Copy link
Member
@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a fair compromise to me. Thanks for putting in the work :-) I think we should hold merge on Ctz's opinion but from my perspective I'm +1.

I left a couple small nits to consider RE: tightening up the unreachable_pub allows but I don't think that needs to be blocking feedback.

Could you also rebase to resolve conflicts? Thanks!

@jadamcrain
Copy link

I like this too. It allows us to use rustls library code for the chain validation, but custom code for the name verification.

This will allow us to shrink our custom verifiers a bit and depend on the default Rustls chain validation piece.

@Fritiofhedstrom Fritiofhedstrom force-pushed the any_domain_name_server_verification_option2_pub_helper_functions branch from acd38b5 to 6cff280 Compare July 4, 2023 07:46
@codecov
Copy link
codecov bot commented Jul 4, 2023

Codecov Report

Merging #1325 (6cff280) into main (215aaf7) will increase coverage by 0.00%.
The diff coverage is 89.39%.

@@           Coverage Diff           @@
##             main    #1325   +/-   ##
=======================================
  Coverage   96.31%   96.32%           
=======================================
  Files          61       61           
  Lines       14282    14299   +17     
=======================================
+ Hits        13756    13773   +17     
  Misses        526      526           
Impacted Files Coverage Δ
rustls/src/verify.rs 90.05% <88.52%> (+0.34%) ⬆️
rustls/src/key.rs 95.65% <100.00%> (+1.20%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member
@ctz ctz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this is a reasonable compromise.

@ctz ctz merged commit 0018e75 into rustls:main Jul 4, 2023
@Fritiofhedstrom
Copy link
Author

Thank you!

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.

5 participants
0