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

Allow empty sni extension #51

Merged

Conversation

max-b
Copy link
Contributor

@max-b max-b commented Jul 22, 2020

This attempts to get merged just the empty SNI changes from #38

I used the changes from #50 to generate the testdata

It looked to me like you had given the 👍 to the empty SNI changes in #38, but let me know if I misread that or if there's anything else you'd like incorporated here.

Thanks!

@sergeyfrolov
Copy link
Member

Thanks for the PR!

I did give 👍 to the empty SNI implementation in #38 (comment) , but in a different way, it seems. If I understand this correctly, the behavior of existing applications that use uTLS with empty SNIs will change with this PR, which is undesirable. We can implement omitting of SNI in a backward compatible way by adding a new RemoveSNIExtension() function. As for the testdata, it would be useful to add a test for theRemoveSNIExtension() function and add a new test trace for it, but all other traces should not change.

@max-b
Copy link
Contributor Author

max-b commented Jul 23, 2020

Great ok that makes sense - thanks for the feedback! I'll get on that.

@max-b
Copy link
Contributor Author

max-b commented Jul 23, 2020

Ok so I reverted the existing commits on this branch (I can either rebase this branch or you can just use github's "squash and merge" functionality if you'd like.

It looked to me like it wouldn't work to have the RemoveSNIExtension work if the ClientHelloID was a HelloGolang, but it seems totally possible that I've missed something.

u_conn.go Outdated
Comment on lines 170 to 178
// RemoveSNIExtension will cause the UConn connection client hello to not include a SNI extension
// This only applies to non-HelloGolang ClientHelloIDs
func (uconn *UConn) RemoveSNIExtension() error {
if uconn.ClientHelloID == HelloGolang {
return fmt.Errorf("Cannot call RemoveSNIExtension on a UConn with a HelloGolang ClientHelloID")
}
uconn.omitSNIExtension = true
return nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This returns an error to prevent someone from accidentally trying to use it on a UConn that has a HelloGolang ClientHelloID

u_conn_test.go Outdated
Comment on lines 369 to 372
test := *template
// clone the test template config so we can successfully re-run
templateConfig := *template.config // nolint
test.config = &templateConfig
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this a reasonable way to clone the test config for re-running it?

Copy link
Member

@sergeyfrolov sergeyfrolov left a comment

Choose a reason for hiding this comment

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

Those look like good changes, but I do have a couple of nitpicks.

It would be nicer if the test was in it's own TestRemoveSNIExtension function such that we could understand immediately if it broke. So, we should not clone the test config.

It also doesn't need to double the amount of test cases just for that feature, I think a single test (with say latest Chrome) is probably enough. My opinion on that is less strong on this one and I am happy to accept a PR that doubles test data, just does not seem necessary.

u_conn.go Outdated
@@ -162,6 +167,26 @@ func (uconn *UConn) SetSNI(sni string) {
}
}

// RemoveSNIExtension will cause the UConn connection client hello to not include a SNI extension
// This only applies to non-HelloGolang ClientHelloIDs
Copy link
Member

Choose a reason for hiding this comment

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

I'd invert the negatives. Something like
"RemoveSNIExtension removes SNI from the list of extensions sent in ClientHello.
It returns an error when used with HelloGolang ClientHelloID."

@max-b
Copy link
Contributor Author

max-b commented Jul 29, 2020

It would be nicer if the test was in it's own TestRemoveSNIExtension function such that we could understand immediately if it broke. So, we should not clone the test config.

It also doesn't need to double the amount of test cases just for that feature, I think a single test (with say latest Chrome) is probably enough. My opinion on that is less strong on this one and I am happy to accept a PR that doubles test data, just does not seem necessary.

Works for me - I agree that's a better approach. Let me know if I've missed anything else.

Thanks!

Copy link
Member

@sergeyfrolov sergeyfrolov left a comment

Choose a reason for hiding this comment

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

Perfect -- thank you for your contribution!

@sergeyfrolov sergeyfrolov merged commit dc2ae3b into refraction-networking:master Jul 29, 2020
@max-b
Copy link
Contributor Author

max-b commented Jul 29, 2020

Great thanks so much!!

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

4 participants