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

Added new defaults for cipher suites and protocols. #928

Closed
wants to merge 13 commits into from
Closed

Added new defaults for cipher suites and protocols. #928

wants to merge 13 commits into from

Conversation

kkocel
Copy link
Contributor

@kkocel kkocel commented Jun 13, 2014

Added new defaults for cipher suites and protocols.

#330
#919

@@ -0,0 +1,120 @@
/*
* Copyright (C) 2013 Square, Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

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

2014

@swankjesse
Copy link
Collaborator

(CLA is good from July 2013)

ENABLED_PROTOCOLS));
}

private String[] intersect(String[] supported, String[] enabled) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is cool! But it makes a lot of garbage. You can probably make things better by calling this from the constructor rather than from each place that it's used.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That said, don't worry about it. We can probably optimize this in a follow-up change.

@swankjesse
Copy link
Collaborator

If you can document the source of the protocols, I think we're good to go. I want to sit on this until OkHttp 2.1, because if we try to put it in OkHttp 2.0 we'll not be able to ship that next week.

String[] intersect(String[] supported, String[] enabled) {
List<String> supportedList = new ArrayList<String>(Arrays.asList(supported));

supportedList.retainAll(Arrays.asList(enabled));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is backwards? The enabled list is in priority order; shouldn't we want to maintain that order? Not entirely certain, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, You're right - I've turned it around. Although supported protocols do not maintain order.


public class OkSslFactoryTest {

private MockWebServer server = new MockWebServer();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use MockWebServerRule

sslSocket.setEnabledCipherSuites(intersectedCiphers);
}

private void applyProtocolOrder(SSLSocket sslSocket) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this and the above method add value and they're only called once. Inline into the caller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Preventing 65k method limit in dex? ;)

- Corrected Indent
- Closing socket
- Added MockWebServerRule
- Refined test
@codefromthecrypt
Copy link

Can we tie this in to somehow help address #959? either by instructions, or automagically?

@kkocel
Copy link
Contributor Author

kkocel commented Jul 9, 2014

"Clients MAY advertise support of other cipher suites in order to
allow for connection to servers that do not support HTTP/2 to
complete without the additional latency imposed by using a separate
connection for fallback.

An implementation SHOULD NOT negotiate a TLS connection for HTTP/2
without also negotiating a cipher suite that meets these
requirements. Due to implementation limitations, it might not be
possible to fail TLS negotiation. An endpoint MUST immediately
terminate an HTTP/2 connection that does not meet these minimum
requirements with a connection error (Section 5.4.1) of type
INADEQUATE_SECURITY."

As far as I understand we can leave protocols as they are but we need to prevent establishing TLS connection for HTTP/2

@swankjesse swankjesse added this to the 2.1 milestone Jul 21, 2014
@kkocel
Copy link
Contributor Author

kkocel commented Sep 8, 2014

@swankjesse How Can I rerun travis build?

@JakeWharton
Copy link
Collaborator

It passed on JDK 7. JDK 8 is broken.

You should really squash all these commits into one, though.

@swankjesse
Copy link
Collaborator

We're now tracking Chrome 37's suites.

@swankjesse swankjesse closed this Oct 11, 2014
@kkocel
Copy link
Contributor Author

kkocel commented Oct 17, 2014

@swankjesse what about protocols? According to latest news we should also disable sslv3. Without this PR this can be problematic in current codebase.

@swankjesse
Copy link
Collaborator

Good point! I think the fix is to add TLS_FALLBACK_SCSV to ClientConfiguration.COMPATIBLE. Would you like to do the honors?

@kkocel
Copy link
Contributor Author

kkocel commented Oct 28, 2014

@swankjesse It will work for legacy servers supporting only SSLv3. What if other security breach will come up in the future? Shouldn't we have some API to disable ciphers / protocols in the future? You are main architects in this project so decision is up to You :)

According to TLS_FALLBACK_SCSV I will do it in separate PR

@swankjesse
Copy link
Collaborator

I'd like to add more methods to ClientConfiguration so you can do whatever configuration you prefer. For example, at Square we'll probably permit only perfect-forward-secrecy cipher suites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature not a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants