-
Notifications
You must be signed in to change notification settings - Fork 275
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
Reduce exposure to the deprecated for-removal javax.security.cert APIs #1128
base: master
Are you sure you want to change the base?
Conversation
Thanks for this! It's been on our radar for a while but unfortunately isn't as simple as this PR. I think for OpenJDK and standalone Android builds, it's probably fine to simply drop support for the However, the Android platform hasn't officially deprecated this API yet, there's just a note in the docs not to use it for new apps. We might be able to get some metrics to see if any apps actually use this in reality. If so, then the best we can probably do is officially deprecate it and add logging at an Android SDK boundary (and we're too late for Android 14) and then remove it at the next one. In the meantime we'll have to support it. And of course it's worse than that. Thanks to the magic of Mainline, any change we make here will get shipped to all Mainline devices running Android 11 or greater and a few devices running Android 10, and we absolutely can't just drop support on those devices if it's in active use, so we'll need to gate it at runtime. Soooooo..... Needs a bit of thinking through, but I think at the next release we can start making I'm guessing you guys aren't terribly interested in doing the Android Platform work? Happy to review it if you are though! |
Actually that might not be true, I'll check and update this thread tomorrow. |
I had a feeling this could be the case :-) I'm reaching out to various projects (BouncyCastle, Tomcat, Netty, Vert.x, Underrow, etc), and I'm doing it mainly in the form of PRs because I think that makes the discussion more focused, practical and actionable. So if this PR isn't merged as-is, I'm still happy if it can help bring the situation forward. (We seem to be in a bit of a stalemate situation, where OpenJDK is waiting for the ecosystem to reduce their exposure to these APIs and the ecosystem seems not sufficiently motivated to do much until OpenJDK actually ships a JDK with the removal. This is not very glamorous work on either side of the fence. It's easier to do nothing.. Considering this, I think you can understand I'm very excited about your response and involvement. Thanks!
Am I right that you are saying that OpenJDK has your/Conscrypt's blessing/support to go ahead and remove this method with the related packages in some not-so-far future release? That would be a great thing to bring home to the OpenJDK discussion.
OpenJDK's introduction of a default https://bugs.openjdk.org/browse/JDK-8241039 It would probably be good to have Android align in behaviour here.
Let me be honest: I have very limited experience with Android, especially on the system side, so I don't even think I understand the terms "standalone Android builds", "Mainline" etc. If you can point me to the relevant code bases, I would be happy to take a look, but don't keep your hopes to high that will produce production ready code :-) Again, thanks for your response and willingness to investigate and discuss this matter. Highly appreciated! |
TBH we've never assumed that upstream OpenJDK would worry about us when making breaking changes. :) I don't mean that in a negative way, just that your priorities are not the same as ours and so it's up to us to react as needed. I think we're all on the same page that these older classes and APIs need to go, but our problem is that we need to continue supporting a wide ecosystem, so it probably helps to clarify some of the terminology you asked about: Conscrypt exists in multiple niches, but the 3 main ones are:
Totally agreed, Android just tends to move slower in order not to break apps using public APIs from the SDK without warning.
Yeah, I totally get that's not your job. :) But FYI Conscrypt standalone and for OpenJDK build directly from the Github source. Differences are handled by the Conscrypt in the Android platform builds from the |
To be clear: I'm not affiliated with Oracle or any other OpenJDK vendor, I'm simply an individual contributor to the project. As an individual, it might actually be easier for me to reach out and contribute to projects in the ecosystem because of reduced organizational and legal concerns. (IANAL) |
Yeah, I really meant "role" there, i.e. we don't expect upstream to solve our problems for us, but we won't complain if you do. Anyway, seems like the SDK for Android 14 / API level 34 is past the point where we can officially deprecate those APIs, so we'll need to support them on Android for at last a year, more like two depending on usage. And I'm pursuing a couple of other angles to try and determine usage (if any)... e.g. errorprone warnings in Android Studio and metric collection. |
Oh, also I can see a way through this which means that only the Android platform build is implementing/exposed to those APIs without it being too fugly. I think it makes sense to drop some of the Java 7 workarounds first though, and probably makes sense to get the next public release done before dropping the Java 7 stuff. |
Sounds promising! I'm not sure if/how Android factors into considerations to remove these APIs at the OpenJDK. It seems that Android Platform is sort-of, sort-of-not related to OpenJDK. But I'm very happy if you can reduce / remove your exposure to these APIs in your OpenJDK code. |
Yeah. Android's runtime virtual machine is all its own, but a significant amount of its Java core libraries come from OpenJDK. There are a bunch of complexity and exceptions, one is that Android doesn't ship any of the Sun security As nobody should be using these anyway, I'm trying to accelerate the process of getting them dropped from the SDK. |
Efforts are underway in the OpenJDK project to remove the long deprecated-for-removal classes in the package javax.security.cert. These classes were introduced for backwards compatibility concerns with the unbundled JSSE release for JDK 1.2/1.3, but their use have been discouraged since they were introduced.
It would be good to update Conscrypt to reduce and contain dependencies on these archaic APIs.
See https://bugs.openjdk.org/browse/JDK-8227024 and the corresponding CSR https://bugs.openjdk.org/browse/JDK-8227395
Changes:
ConscryptSession.getPeerCertificateChain
which throws anUnsupportedOperationException
like Java 15.ActiveSession
,ExternalSession
,Java7ExtendedSSLSession
,SessionSnapshot
,SSLNullSession
to remove thegetPeerCertificateChain
implementations.SSLUtils.toCertificateChain
utility methodSSLSessionTest.test_SSLSession_getPeerCertificateChain
test methodSSLSocketVersionCompatibilityTest
to not callHandshakeCompletedEvent.getPeerCertificateChain
and to not assert on the results obtain by calling this method.