{"record":{"id":"21b775df649273f3","repo":"NationalSecurityAgency/ghidra","slug":"missing-username-for-password-change-21b775","errorCode":null,"errorMessage":"Missing username for password change","messagePattern":"Missing username for password change","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":3420,"sourceCode":"\t\tresponse.errorMessage = null;\n\t\ttry {\n\t\t\tdropDatabase();\n\t\t}\n\t\tcatch (ElasticException e) {\n\t\t\tresponse.dropSuccessful = false;\n\t\t\tresponse.errorMessage = e.getMessage();\n\t\t}\n\t}\n\n\t/**\n\t * Entry point for the Elasticsearch version of PasswordChange command.\n\t * @param query is command parameters\n\t * @throws LSHException if details of the request are malformed\n\t */\n\tprivate void fdbPasswordChange(PasswordChange query) throws LSHException {\n\t\tResponsePassword response = query.passwordResponse;\n\t\tif (query.username == null) {\n\t\t\tthrow new LSHException(\"Missing username for password change\");\n\t\t}\n\t\tif (query.newPassword == null || query.newPassword.length == 0) {\n\t\t\tthrow new LSHException(\"No password provided\");\n\t\t}\n\t\tresponse.changeSuccessful = true;\t\t// Response parameters assuming success\n\t\tresponse.errorMessage = null;\n\t\ttry {\n\t\t\tchangePasswordInternal(query.username, query.newPassword);\n\t\t}\n\t\tcatch (ElasticException ex) {\n\t\t\tresponse.changeSuccessful = false;\n\t\t\tresponse.errorMessage = ex.getMessage();\n\t\t}\n\t\tquery.clearPassword();\n\t}\n\n\t/**\n\t * Given the document id for a specific function. Query for the document and","sourceCodeStart":3402,"sourceCodeEnd":3438,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L3402-L3438","documentation":"fdbPasswordChange requires query.username; if it is null it throws LSHException(\"Missing username for password change\") (a subsequent check rejects a missing password). Nothing is sent to the server.","triggerScenarios":"A PasswordChange request constructed without setting the username field.","commonSituations":"Programmatically building a PasswordChange and forgetting username; a CLI missing the --user argument.","solutions":["Set username on the request before submitting.","Validate request completeness client-side before issuing the command."],"exampleFix":"// before\nPasswordChange req = new PasswordChange();\nreq.newPassword = pw;            // username forgotten\n// after\nPasswordChange req = new PasswordChange();\nreq.username = requireUser();    // non-null\nreq.newPassword = pw;","handlingStrategy":"validation","validationCode":"if (req.username == null || req.username.isBlank())\n    throw new IllegalArgumentException(\"Password change requires a username\");","typeGuard":"boolean hasUser = req.username != null && !req.username.isBlank();","tryCatchPattern":null,"preventionTips":["Enforce required fields in the request builder.","Require --user on any password-change CLI."],"tags":["bsim","authentication","validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}