Skip to content

8339347: keytool -importpass insists prompting the user even if there is no terminal #20855

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

Closed
wants to merge 3 commits into from

Conversation

haimaychao
Copy link
Contributor

@haimaychao haimaychao commented Sep 4, 2024

Given the changes to the System.console() behavior, where it no longer returns null when a write pipe is connected to the Java process, keytool needs to be updated to determine whether an interactive terminal is attached.


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

Warning

 ⚠️ Found leading lowercase letter in issue title for 8339347: keytool -importpass insists prompting the user even if there is no terminal

Issue

  • JDK-8339347: keytool -importpass insists prompting the user even if there is no terminal (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20855/head:pull/20855
$ git checkout pull/20855

Update a local copy of the PR:
$ git checkout pull/20855
$ git pull https://git.openjdk.org/jdk.git pull/20855/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20855

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20855.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 4, 2024

👋 Welcome back hchao! 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
Copy link

openjdk bot commented Sep 4, 2024

@haimaychao This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8339347: keytool -importpass insists prompting the user even if there is no terminal

Reviewed-by: weijun

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 131 new commits pushed to the master branch:

  • 9e1af8c: 8339285: Test fails with assert(depth < max_critical_stack_depth) failed: can't have more than 10 critical frames
  • 48d7943: 8339342: FieldAllocationCount is mostly unused
  • e203df4: 8338100: C2: assert(!n_loop->is_member(get_loop(lca))) failed: control must not be back in the loop
  • 98020e4: 8338133: Cleanup direct use of new HtmlTree
  • b895d7c: 8332423: [PPC64] Remove C1_MacroAssembler::call_c_with_frame_resize
  • 59c4649: 8329959: Update DigestMD5Client.java - fix typo in javadoc string
  • 4ffcf89: 8339619: ProblemList runtime/cds/appcds/jvmti/dumpingWithAgent/DumpingWithJavaAgent.java
  • 042053c: 8003887: File.getCanonicalFile() does not resolve symlinks on MS Windows
  • b389bb4: 8339540: Unify include requirements for PlatformMonitor/Mutex constructors/destructors
  • ab656c3: 8339579: ZGC: Race results in only one of two remembered sets being cleared
  • ... and 121 more: https://git.openjdk.org/jdk/compare/a827ff05dba0c9b7c74d83053a35c8041c1ac5cc...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 4, 2024
@openjdk
Copy link

openjdk bot commented Sep 4, 2024

@haimaychao The following label will be automatically applied to this pull request:

  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.org label Sep 4, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 4, 2024

Webrevs

@wangweij
Copy link
Contributor

wangweij commented Sep 4, 2024

Do you need to check Password::readPassword(InputStream in, boolean isEchoOn) also? I'm not sure.

@haimaychao
Copy link
Contributor Author

The Password::readPassword(InputStream in, boolean isEchoOn) is used to control whether characters are echoed on the screen as the user types the password. In this keytool use case, Password::readPassword(InputStream in) works as expected (i.e. reading passwords from stdin without any need to control echo), and I'd think additional echo handling seems not relevant here.


public class TestImportPass {
public static void main(String[] args) throws Throwable {
SecurityTools.setResponse("pass123", "pass123");
Copy link
Contributor

Choose a reason for hiding this comment

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

If console is not terminal, it looks like there is no need to repeat the passphrase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, removed it.

Copy link
Contributor

@wangweij wangweij left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 5, 2024
@haimaychao
Copy link
Contributor Author

@wangweij Thanks for the review.

@haimaychao
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 5, 2024

Going to push as commit 8fb8cd8.
Since your change was applied there have been 131 commits pushed to the master branch:

  • 9e1af8c: 8339285: Test fails with assert(depth < max_critical_stack_depth) failed: can't have more than 10 critical frames
  • 48d7943: 8339342: FieldAllocationCount is mostly unused
  • e203df4: 8338100: C2: assert(!n_loop->is_member(get_loop(lca))) failed: control must not be back in the loop
  • 98020e4: 8338133: Cleanup direct use of new HtmlTree
  • b895d7c: 8332423: [PPC64] Remove C1_MacroAssembler::call_c_with_frame_resize
  • 59c4649: 8329959: Update DigestMD5Client.java - fix typo in javadoc string
  • 4ffcf89: 8339619: ProblemList runtime/cds/appcds/jvmti/dumpingWithAgent/DumpingWithJavaAgent.java
  • 042053c: 8003887: File.getCanonicalFile() does not resolve symlinks on MS Windows
  • b389bb4: 8339540: Unify include requirements for PlatformMonitor/Mutex constructors/destructors
  • ab656c3: 8339579: ZGC: Race results in only one of two remembered sets being cleared
  • ... and 121 more: https://git.openjdk.org/jdk/compare/a827ff05dba0c9b7c74d83053a35c8041c1ac5cc...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 5, 2024
@openjdk openjdk bot closed this Sep 5, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 5, 2024
@openjdk
Copy link

openjdk bot commented Sep 5, 2024

@haimaychao Pushed as commit 8fb8cd8.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants