{"record":{"id":"8441cb371a0ae734","repo":"NationalSecurityAgency/ghidra","slug":"invalid-userinfo-specified","errorCode":null,"errorMessage":"Invalid userinfo specified","messagePattern":"Invalid userinfo specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java","lineNumber":238,"sourceCode":"\t\tString urlUserInfo;\n\t\tif (pwSep >= 0) {\n\t\t\turlUserInfo = urlDecode(userinfo.substring(0, pwSep)) + \":\" +\n\t\t\t\turlDecode(userinfo.substring(pwSep + 1));\n\t\t}\n\t\telse {\n\t\t\turlUserInfo = urlDecode(userinfo);\n\t\t}\n\t\treturn cleanupUserInfo(urlUserInfo);\n\t}\n\n\tprivate static String cleanupUserInfo(String userinfo) {\n\t\tif (StringUtils.isBlank(userinfo)) {\n\t\t\treturn null;\n\t\t}\n\t\tuserinfo = userinfo.trim();\n\t\tint pwdSep = userinfo.indexOf(':');\n\t\tif (pwdSep == 0) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid userinfo specified\");\n\t\t}\n\t\telse if (pwdSep > 0 && (userinfo.length() - pwdSep) == 0) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid userinfo specified\");\n\t\t}\n\t\treturn userinfo;\n\t}\n\n\tprivate static String cleanupFilename(String name) {\n\t\t// transform dbName into acceptable H2 DB file path\n\n\t\tMatcher m = BAD_H2_CHARS_PATTERN.matcher(name);\n\t\tif (m.matches()) {\n\t\t\tthrow new IllegalArgumentException(\"Bad character in H2 database path. \" +\n\t\t\t\t\"Disallowed characters: \" + BAD_H2_CHARS);\n\t\t}\n\t\tString dbName = name.trim();\n\t\tdbName = dbName.replace(\"\\\\\", \"/\");\n\t\tif ((!dbName.startsWith(\"/\") && !isWindowsFilePath(dbName)) || dbName.endsWith(\"/\")) {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java#L220-L256","documentation":"Thrown by cleanupUserInfo() when the userinfo string's first character is a colon (pwdSep == 0), meaning the username portion is empty (e.g. ':password'). A userinfo credential must have a non-empty username. Throws IllegalArgumentException.","triggerScenarios":"Constructing a BSimServerInfo from a URL or value whose userinfo is ':password' (colon at index 0, empty user), e.g. 'postgresql://:secret@host:5432/db'.","commonSituations":"Building a userinfo string by concatenation with a null/empty username; stripping the username during sanitization; mis-parsed credentials.","solutions":["Ensure the userinfo begins with a non-empty username, e.g. 'user:password'.","If no password is needed, omit it entirely: 'user@host'.","Validate that the username is non-empty before forming the userinfo."],"exampleFix":"// before\nnew BSimServerInfo(new URL(\"postgresql://:\" + pwd + \"@host:5432/db\"));\n// after (include username)\nnew BSimServerInfo(new URL(\"postgresql://\" + user + \":\" + pwd + \"@host:5432/db\"));","handlingStrategy":"validation","validationCode":"String ui = userinfo == null ? null : userinfo.trim();\nif (ui != null && ui.startsWith(\":\")) {\n    throw new IllegalArgumentException(\"userinfo must start with a non-empty username\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure userinfo begins with a non-empty username before forming a BSim URL.","Omit the password segment entirely when no password is needed.","Validate credentials in a helper before constructing BSimServerInfo."],"tags":["bsim","validation","database-url","credentials"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}