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

Conversation

@pontusmelke
Copy link
Collaborator

When a user ran

cypher-shell -d system  -u neo4j -p neo4j --format=plain 'ALTER CURRENT USER SET PASSWORD from "neo4j" to "quality" ';

and the password neo4j was expired we still prompted the user for
providing a new password. This also meant that the change password
command later failed since the password had already been changed.

changelog: Fix a bug where a user attempting to update an expired password non-interactively still was prompted for new password.

}

private boolean isAttemptingPasswordChange( CliArgs args ) {
return args.getCypher().map( (s) -> s.toUpperCase().startsWith( "ALTER CURRENT USER SET PASSWORD FROM" ) ).orElse( false );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this detection a bit weak w.r.t e.g. comments in the beginning of a .cypher file or formatting whitespace, etc. ?


SessionConfig.Builder builder = SessionConfig.builder()
.withDefaultAccessMode(AccessMode.WRITE)
.withDatabase(SYSTEM_DB_NAME);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this a bit weird? I think we will end up here, using the system-db, even if the user invoked it like this: cypher-shell -d my-db-which-is-not-the-system-db -u user -p pass 'ALTER CURRENT USER SET PASSWORD from "pass" to "newPass" ';

Also it is weird to have such connection things going on here, which usually happens in Main. Can we not use the same code (i.e. runUntilEnd), but parameterize connectMaybeInteractively somehow?

When a user ran
```
cypher-shell -d system  -u neo4j -p neo4j --format=plain 'ALTER CURRENT USER SET PASSWORD from "neo4j" to "quality" ';
```

and the password `neo4j` was expired we still prompted the user for
providing a new password. This also meant that the change password
command later failed since the password had already been changed.
@pontusmelke pontusmelke force-pushed the 4.0-allow-password-change branch from ffe353f to a18f541 Compare February 5, 2020 13:06
@pontusmelke pontusmelke force-pushed the 4.0-allow-password-change branch from 470010f to a18bcd6 Compare February 5, 2020 14:28
Copy link
Collaborator

@sherfert sherfert left a comment

Choose a reason for hiding this comment

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

I like this new design, and the more comprehensive tests.
Just some minor nitpicks.

int majorVersion = getVersionAndCreateUserWithPasswordChangeRequired();

//in 4.0 and later when the user attempts a non-interactive password update
if (majorVersion >= 4 ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could use assume here, since this test has no value if running with neo4j 3.5 or older.

int majorVersion = getVersionAndCreateUserWithPasswordChangeRequired();

//in 4.0 and later when the user attempts a non-interactive password update
if (majorVersion >= 4 ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

assume

int majorVersion = getVersionAndCreateUserWithPasswordChangeRequired();

//in 4.0 and later when the user attempts a non-interactive password update
if (majorVersion >= 4 ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

assume

shellRunner.runUntilEnd();

main.runShell(cliArgs, shell, logger);
// ConnectionConfig connectionConfig = sac.connectionConfig;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Commented code.


CypherShell shell = new CypherShell( logger, prettyConfig, ShellRunner.shouldBeInteractive( cliArgs ),
cliArgs.getParameters() );
System.exit( runShell( cliArgs, shell, logger ) );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Weird indentation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you split this into two lines? I know this is identical, but I think it will be easier to follow.

@pontusmelke pontusmelke merged commit 5494d30 into neo4j:4.0 Feb 7, 2020
@pontusmelke pontusmelke deleted the 4.0-allow-password-change branch February 7, 2020 05:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants