Skip to content

8354469: Keytool exposes the password in plain text when command is piped using | grep - #3233

Open
fitzsim wants to merge 6 commits into
openjdk:masterfrom
fitzsim:backport-8354469-keytool-echo-fix
Open

fitzsim wants to merge 6 commits into
openjdk:masterfrom
fitzsim:backport-8354469-keytool-echo-fix

Conversation

@fitzsim

@fitzsim fitzsim commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

This pull request backports:

8354469: Keytool exposes the password in plain text when command is piped using | grep

It depends on pull request #3232 which backports:

8366261: Provide utility methods for sun.security.util.Password

Starting from the backport of 8354469 to 17, I made the following adjustments:

Console.java:

  • Its change applied with a minor line offset, looks fine.

Password.java:

  • Adjust copyright year

  • 17 renamed "misc" to "access" in "import jdk.internal.access.SharedSecrets;" as part of:

    8211122: Reduce the number of internal classes made accessible to jdk.unsupported

    so skip that.

  • 17 then removed "import jdk.internal.access.SharedSecrets;" and called "System.console().charset()" directly instead of via SharedSecrets as part of:

    8264208: Console charset API

    which was never backported, so skip that and continue using SharedSecrets.

  • 17 re-added "import jdk.internal.access.SharedSecrets;" as part of:

    8354469: Keytool exposes the password in plain text when command is piped using | grep

    to be able to call passwordConsole and readPasswordNoNewLine, so again, I just keep "import jdk.internal.misc.SharedSecrets;" constant in 11

  • 11 does not have Console.charset, so modify the JavaIOAccess interface to accept a Console argument which returns the value of the passed console's private charset (cs) field.

SetInPassword.java:

  • Fine as-is, passes.

EchoPassword.java:

  • Change to use traditional multiline-string syntax since 11 does not support """ multiline strings; update message whitespace

  • Remove support for the convenience "Copy Command" hyperlinks since hyperlinkListener support is not available in 11; update message accordingly

    I did briefly try to maintain these links and status label, but it would have required first backporting:

    8367348: Enhance PassFailJFrame to support links in HTML

    which did not apply cleanly to 11, so I decided to simplify the test instead.

  • Remove the now-unused status label

Usages.java:

  • Drop test/jdk/sun/security/util/Resources/Usages.java changes since
    that file does not exist in 11

The new SetInPassword.java test passes and with the modifications herein, the EchoPassword.java also passes.



Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8354469 needs maintainer approval

Issue

  • JDK-8354469: Keytool exposes the password in plain text when command is piped using | grep (Enhancement - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/3233/head:pull/3233
$ git checkout pull/3233

Update a local copy of the PR:
$ git checkout pull/3233
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/3233/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3233

View PR using the GUI difftool:
$ git pr show -t 3233

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/3233.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Jun 26, 2026

Copy link
Copy Markdown

👋 Welcome back fitzsim! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Jun 26, 2026

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot changed the title Backport a7a3a660e33fabc025ebe887f5605741be9ca8c3 8354469: Keytool exposes the password in plain text when command is piped using | grep Jun 26, 2026
@openjdk

openjdk Bot commented Jun 26, 2026

Copy link
Copy Markdown

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk Bot added the backport Port of a pull request already in a different code base label Jun 26, 2026
@bridgekeeper

bridgekeeper Bot commented Aug 21, 2026

Copy link
Copy Markdown

@fitzsim This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@fitzsim

fitzsim commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

/touch

@openjdk

openjdk Bot commented Aug 26, 2026

Copy link
Copy Markdown

@fitzsim The pull request is being re-evaluated and the inactivity timeout has been reset.

@gnu-andrew

Copy link
Copy Markdown
Member

This one should now be rebased on current 11u-dev to remove the commit that has been pushed.

…iped using | grep

Backport-of: a7a3a660e33fabc025ebe887f5605741be9ca8c3
This gives sun.security.util.Password access to the password console's
charset field.
Remove the "Copy" hyperlinks and instead just instruct the user to
copy each command manually.

Add spaces where necessary.
@fitzsim
fitzsim force-pushed the backport-8354469-keytool-echo-fix branch from 5146aa5 to 1548c15 Compare September 21, 2026 21:48
@fitzsim
fitzsim marked this pull request as ready for review September 23, 2026 13:41
@fitzsim

fitzsim commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

This one should now be rebased on current 11u-dev to remove the commit that has been pushed.

Done. I marked this as ready-for-review.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Sep 23, 2026
@mlbridge

mlbridge Bot commented Sep 23, 2026

Copy link
Copy Markdown

Webrevs

@gnu-andrew

Copy link
Copy Markdown
Member

A backport of 8367348 was started (#3147) but didn't make any progress when I identified required dependencies. I now have a dependency chain of backports ending in that one which I just need to test (had X11 permission errors in trying last week that hopefully Xephyr will resolve). We should then be able to include those changes as is.

Similarly, I'll look at what is required to include the other test. It is generally preferable to keep the test code as is and bring in dependencies if possible. Also the 8367348 update already came up as a parity backport.

@bridgekeeper

bridgekeeper Bot commented Oct 25, 2026

Copy link
Copy Markdown

@fitzsim This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@fitzsim

fitzsim commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

/keepalive

@openjdk

openjdk Bot commented Oct 29, 2026

Copy link
Copy Markdown

@fitzsim The pull request is being re-evaluated and the inactivity timeout has been reset.

@bridgekeeper

bridgekeeper Bot commented Nov 27, 2026

Copy link
Copy Markdown

@fitzsim This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@fitzsim

fitzsim commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/touch

@fitzsim

fitzsim commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

A backport of 8367348 was started (#3147) but didn't make any progress when I identified required dependencies. I now have a dependency chain of backports ending in that one which I just need to test (had X11 permission errors in trying last week that hopefully Xephyr will resolve). We should then be able to include those changes as is.

Do you want to share some of these and I can try to test them?

Similarly, I'll look at what is required to include the other test. It is generally preferable to keep the test code as is and bring in dependencies if possible. Also the 8367348 update already came up as a parity backport.

OK, I'll try to take a look at what's required there.

@openjdk

openjdk Bot commented Nov 27, 2026

Copy link
Copy Markdown

@fitzsim The pull request is being re-evaluated and the inactivity timeout has been reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants