Skip to content

TRUNK-6645: Prevent clearPasswords() from wiping wizard credentials mid-flow#6152

Open
solomonfortune wants to merge 5 commits into
openmrs:masterfrom
solomonfortune:TRUNK-6645
Open

TRUNK-6645: Prevent clearPasswords() from wiping wizard credentials mid-flow#6152
solomonfortune wants to merge 5 commits into
openmrs:masterfrom
solomonfortune:TRUNK-6645

Conversation

@solomonfortune
Copy link
Copy Markdown

Description of what I changed

Added a passwordsEntered flag to InitializationWizardModel that is set to true when the user submits credentials in either the simple or advanced setup path, and reset to false inside clearPasswords().
The page == null branch in doGet() now only calls clearPasswords() when the flag is false, i.e. before any credentials have been entered.

Previously, any parameterless GET to /initialsetup (caused by a favicon request, browser refresh, Back button, or StartupFilter redirect) would call clearPasswords() unconditionally on the shared singleton wizardModel, blanking all five password fields even after the user had already entered them.
Since SessionModelUtils deliberately excludes password fields from the session round-trip, the wiped values could not be restored, causing the background install thread to connect with an empty password and fail with: Access denied for user 'root'@'localhost' (using password: NO)

Files changed:

  • InitializationWizardModel.java — added passwordsEntered flag
  • InitializationFilter.java — guard clearPasswords(), set flag on credential submission, reset flag inside clearPasswords()

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-6645

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.
  • I have added tests to cover my changes. (If you refactored existing code that was well tested you do not have to add tests)
  • I ran mvn clean package right before creating this pull request and added all formatting changes to my commit.
  • All new and existing tests passed.
  • My pull request is based on the latest changes of the master branch.

Copy link
Copy Markdown
Contributor

@jwnasambu jwnasambu left a comment

Choose a reason for hiding this comment

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

@solomonfortune Kindly do you mind fixing the merge conflicts please?

…id-flow

During first-time setup, any parameterless GET to /initialsetup
(caused by a favicon request, redirect, refresh, or Back button)
triggered clearPasswords() on the shared singleton wizardModel,
blanking all password fields even after the user had entered them.
Because SessionModelUtils deliberately excludes password fields from
the session round-trip, the wiped values could not be restored,
causing the background install thread to connect with an empty
password and fail with 'Access denied (using password: NO)'.

Fix: add a passwordsEntered flag to InitializationWizardModel that
is set to true when the user submits credentials (simple or advanced
path) and reset to false inside clearPasswords(). The page==null
branch in doGet() now only calls clearPasswords() when the flag is
false, i.e. before any credentials have been entered.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants