Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Conversation

@voutilad
Copy link
Contributor

I found that if a 4.0/4.1 user had their account set to requiring a password change (for instance, after a fresh install), cypher-shell would still prompt for the new password when using --non-interactive.

This prevents safe usage via shell scripts, Ansible, etc. that will never send a newline to stdin causing the cypher-shell program to never exit.

Lots of checks are done if stdin is connected to a tty and somewhere in
the mess of logic a check doesn't work properly (at least on Linux) when
using --non-interactive via a shell. For instance, if the user account
requires a password being changed, it still prompts the user.

This checks the cli arg first before bothering to check the
System.console() / isatty() results. This trickles down to checks again
during the initial exception handling AuthenticationException or
Neo4jException handling.
@pontusmelke pontusmelke self-assigned this Aug 4, 2020
Copy link
Collaborator

@pontusmelke pontusmelke left a comment

Choose a reason for hiding this comment

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

@voutilad Thanks for the PR and forgive me for dropping the ball here a little bit, I should have got to this PR earlier. I think we can't change the default behaviour where if you run a script and needs to change password you get prompted since that is the behavior we've had since 4.0. However I agree that when using --non-interactive this behavior should be overridden. I made an attempt at that here, #249.

So either apply that last commit here or I can push it to your branch but then you must whitelist me as a contributor to your fork.

@voutilad
Copy link
Contributor Author

voutilad commented Sep 3, 2020

@pontusmelke just incorporated your commit.

@pontusmelke pontusmelke merged commit 48b93f9 into neo4j:4.2 Sep 14, 2020
@pontusmelke
Copy link
Collaborator

@voutilad thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants