8269039: Disable SHA-1 Signed JARs#154
Conversation
|
👋 Welcome back abakhtin! A progress list of the required criteria for merging this PR into |
|
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
|
@martinuy Could you please help review this? Thank you! |
martinuy
left a comment
There was a problem hiding this comment.
Hi @alexeybakhtin ,
Thanks for proposing this backport.
In addition to the inlined comments, I have this additional observation:
jdk/test/sun/security/tools/jarsigner/oldsig.shis using SHA1, as well as JDK-11's OldSig.java. The security properties file that is now passed has the following comment: "Re-enable SHA-1 since OldSig.java test uses it". You mentioned 8217375 as the reason why changes are not required for the backport, but I'm having difficulties to find the connection and wonder if we should re-enable SHA1 foroldsig.sh. Can you please elaborate a bit on this?
Thanks,
Martin.-
| import java.nio.file.Paths; | ||
| import java.util.List; | ||
|
|
||
| import jdk.test.lib.process.ProcessTools; |
There was a problem hiding this comment.
The ProcessTools class in JDK-8 has always been jdk.testlibrary.ProcessTools. To use it, you would only need @library /lib/testlibrary in the test's JTREG header. Unfortunately, one backport -which I presume to be JFR- introduced the same class, from a newer JDK release, at a different location. So we now have duplicated code for this test library and it is causing confusion: I can now see a couple of TLS test using this library when they shouldn't. Until we get rid of this technical debt, I suggest that all JDK-8 tests keep using jdk.testlibrary.ProcessTools.
There was a problem hiding this comment.
Thank you. You are right. jdk.testlibrary.ProcessTools is a better choice even if some modifications are required.
Fixed
| .shouldContain("treated as unsigned") | ||
| .shouldMatch("Timestamp.*digest.*SHA-1.*(disabled)"); | ||
|
|
||
| // Disabled algorithms |
There was a problem hiding this comment.
Isn't this comment removed?
There was a problem hiding this comment.
Thank you. Fixed
|
Hello @martinuy |
|
I've verified that test @alexeybakhtin, my suggestion would be to backport the JDK-11 OldSig.java test to JDK-8. I agree with you that doing all the .sh -> .Java test conversions is out of the scope of this backport, but I would make an exception for the case discussed here because, otherwise, we would be having a broken/useless test in JDK-8. I'm also open to consider adding a better assertion statement to the current .sh test. What do you think? |
|
@martinuy, thank you for the review again. |
|
@alexeybakhtin , thanks for addressing this concern. What do you think about the following (minor) change to your proposal? diff --git a/jdk/test/sun/security/tools/jarsigner/oldsig.sh b/jdk/test/sun/security/tools/jarsigner/oldsig.sh -echo "${TESTJAVA}${FS}bin${FS}jarsigner -verify ${KS_ARGS} ${PROP_ARGS} -verbose B.jar" |
|
@martinuy, Thank you! Sure it is better. Test updated |
martinuy
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks for this contribution.
|
@alexeybakhtin This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 19 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
One last note/reminder, this change has a CSR so 8u maintainers will look into that to approve this change. |
|
This is scary stuff. Clearly it isn't a backwards-compatible change. I guess the way this works is that JARs timestamped prior to January 01, 2019 are accepted, but only until the signing certificate expires. Right? |
|
The crypto roadmap mentions it's been included in Oracle JDK 8u351 (October 2022 CPU). While not 100% backwards compatible it's the default that is changing, right? So we should have it in OpenJDK 8u too and the CSR mentions it can be worked around by modifying |
|
Right, it can be easily workarounded by removing SHA1 restriction from java.security file |
The behavior of the SHA-1 signed certificates before January 01, 2019 is not changed. They are still valid even if the signer certificate expires. The changes apply to JARs signed after January 01, 2019 |
|
Notice that for the 2019-01-01 max date to work, the JAR has to be timestamped by a TSA (Time Stamp Authority). While the default behavior is changed (there is a CSR attached to this bug that has to be proposed for 8u as I commented before), the user can restore backward compatibility by re-enabling the use of the SHA-1 algorithm without conditions for JAR signing. You can verify how this works in the fix for this test. Also, the Release Note attached to this bug indicates how to restore backward compatibility. These crypto changes are part of the crypto roadmap as @jerboaa mentioned. I think it's good to be aligned on that roadmap for parity with other JDKs and for security. The change has been backported to other JDK releases too, such as 11u. While I understand the concerns discussed here, I think that we have countermeasures to mitigate that and my recommendation to 8u maintainers is to approve this change. |
|
/integrate |
|
Going to push as commit c501bfa.
Your commit was automatically rebased without conflicts. |
|
@alexeybakhtin Pushed as commit c501bfa. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
I agree it needs to be done, but I think, at this stage, it should have been delayed to 8u372. There are follow-on issues for this - e.g. https://bugs.openjdk.org/browse/JDK-8275887 - which will now have to be resolved during rampdown. |
|
@gnu-andrew, Thank you for the comment. I've submitted PR for the backport of JDK-8275887 |
|
Thanks. It'll need to be against https://github.com/openjdk/jdk8u once I've finished promoting b05 to make 8u362. jdk8u-dev is now for 8u372 changes. |
|
@gnu-andrew, New pull request against jdk8u was created : openjdk/jdk8u#24 |
I'd like to backport this enhancement for parity with Oracle and the security roadmap [1]
The patch is based on the OpenJDK11 backport [2]
The changes are the following:
All java/security/Security sun/security/tools regression tests passed
[1] - https://www.java.com/en/jre-jdk-cryptoroadmap.html
[2] - openjdk/jdk11u-dev@5a0824b
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev pull/154/head:pull/154$ git checkout pull/154Update a local copy of the PR:
$ git checkout pull/154$ git pull https://git.openjdk.org/jdk8u-dev pull/154/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 154View PR using the GUI difftool:
$ git pr show -t 154Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/154.diff