{"record":{"id":"01acd1e90f75bfaf","repo":"NationalSecurityAgency/ghidra","slug":"invalid-dbname","errorCode":null,"errorMessage":"Invalid {} dbName: {}","messagePattern":"Invalid (.+?) dbName: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java","lineNumber":100,"sourceCode":"\n\t\tif ((dbType == DBType.postgres || dbType == DBType.elastic) && StringUtils.isEmpty(host)) {\n\t\t\tthrow new IllegalArgumentException(\"host required\");\n\t\t}\n\n\t\tdbName = dbName.trim();\n\t\tif (StringUtils.isEmpty(dbName)) {\n\t\t\tthrow new IllegalArgumentException(\"Non-empty dbName required\");\n\t\t}\n\n\t\tif (dbType == DBType.file) {\n\t\t\thost = null;\n\t\t\tport = -1;\n\t\t\tuserinfo = null;\n\t\t\tdbName = cleanupFilename(dbName);\n\t\t}\n\t\telse {\n\t\t\tif (dbName.contains(\"/\") || dbName.contains(\"\\\\\")) { // may want additional validation\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid \" + dbType + \" dbName: \" + dbName);\n\t\t\t}\n\t\t\tuserinfo = cleanupUserInfo(userinfo);\n\t\t\tif (port <= 0) {\n\t\t\t\tport = -1;\n\t\t\t}\n\t\t\tif (dbType == DBType.postgres && port <= 0) {\n\t\t\t\tport = DEFAULT_POSTGRES_PORT;\n\t\t\t}\n\t\t\tif (dbType == DBType.elastic && port <= 0) {\n\t\t\t\tport = DEFAULT_ELASTIC_PORT;\n\t\t\t}\n\t\t}\n\n\t\tthis.userinfo = userinfo;\n\t\tthis.host = host;\n\t\tthis.port = port;\n\t\tthis.dbName = dbName;\n\t}","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimServerInfo.java#L82-L118","documentation":"Thrown by the multi-argument BSimServerInfo constructor when dbType is postgres or elastic and the dbName contains a forward slash ('/') or backslash ('\\'). Network database names must be simple identifiers with no path separators; a separator usually indicates the caller mistakenly passed a file path. Throws IllegalArgumentException.","triggerScenarios":"Passing a file-path-style dbName such as '/var/bsim/data' or 'C:\\bsim' to the postgres/elastic constructor.","commonSituations":"Reusing a file-system path as the dbName for a network DB; copy-pasting a datadir path into the dbName field; incorrect DBType chosen (file path passed to a postgres descriptor).","solutions":["Pass a simple database name (no slashes) for postgres/elastic types.","If the value is actually a file path, use DBType.file instead.","Strip or reject path separators from user-supplied dbName input before construction."],"exampleFix":"// before\nnew BSimServerInfo(DBType.postgres, null, \"host\", 5432, \"/var/bsim/data\");\n// after (simple name for postgres)\nnew BSimServerInfo(DBType.postgres, null, \"host\", 5432, \"bsimdb\");","handlingStrategy":"validation","validationCode":"if ((type == BSimServerInfo.DBType.postgres || type == BSimServerInfo.DBType.elastic) && (dbName.contains(\"/\") || dbName.contains(\"\\\\\"))) {\n    throw new IllegalArgumentException(\"postgres/elastic dbName must not contain path separators: \" + dbName);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass simple identifiers as dbName for network databases.","If the value looks like a path, route it to DBType.file instead.","Reject path separators in user input before constructing BSimServerInfo."],"tags":["bsim","validation","database-url"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}