{"record":{"id":"4b7f2a386e045e3a","repo":"NationalSecurityAgency/ghidra","slug":"bad-characters-in-proposed-category-type-4b7f2a","errorCode":null,"errorMessage":"Bad characters in proposed category type","messagePattern":"Bad characters in proposed category type","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":2919,"sourceCode":"\t\t\t}\n\t\t\tif (!names.add(name)) {\n\t\t\t\tthrow new LSHException(\"Duplicate \" + type + \" entry specified: \" + name);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Entry point for the InstallCategoryRequest command:\n\t *   Install a new executable category to be managed by the database\n\t * @param query is command parameters\n\t * @throws LSHException if the command is misconfigured\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void fdbInstallCategory(InstallCategoryRequest query)\n\t\t\tthrows LSHException, ElasticException {\n\t\tResponseInfo response = query.installresponse;\n\t\tif (!CategoryRecord.enforceTypeCharacters(query.type_name)) {\n\t\t\tthrow new LSHException(\"Bad characters in proposed category type\");\n\t\t}\n\t\tif (query.isdatecolumn) {\n\t\t\tinfo.dateColumnName = query.type_name;\n\t\t\tStringBuilder buffer = new StringBuilder();\n\t\t\tbuffer.append(\"{ \\\"type\\\": \\\"keyvalue\\\", \\\"value\\\": \\\"\")\n\t\t\t\t\t.append(info.dateColumnName)\n\t\t\t\t\t.append(\"\\\" }\");\n\t\t\tconnection.executeStatementNoResponse(ElasticConnection.PUT, \"configuration/datecolumn\",\n\t\t\t\tbuffer.toString());\n\t\t\tresponse.info = info;\n\t\t\treturn;\n\t\t}\n\t\t// Check for existing category\n\t\tif (info.execats != null) {\n\t\t\tfor (String cat : info.execats) {\n\t\t\t\tif (cat.equals(query.type_name)) {\n\t\t\t\t\tthrow new LSHException(\"Executable category already exists\");\n\t\t\t\t}","sourceCodeStart":2901,"sourceCodeEnd":2937,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L2901-L2937","documentation":"fdbInstallCategory validates query.type_name with enforceTypeCharacters; if it fails (null/empty or a disallowed character) it throws LSHException(\"Bad characters in proposed category type\") before writing anything to configuration.","triggerScenarios":"An InstallCategoryRequest whose type_name is None, empty, or contains characters outside the allowed set (alphanumeric, space, . _ : / ( )).","commonSituations":"Category name derived from a path/symbol with disallowed punctuation; empty value from a missing CLI arg; trailing newline.","solutions":["Sanitize type_name to the allowed character set before issuing the request.","Reject null/empty upstream and surface a clear form/CLI error."],"exampleFix":"// before\nreq.type_name = raw; // 'my-category'\n// after\nreq.type_name = sanitizeCategory(raw); // 'my_category'","handlingStrategy":"validation","validationCode":"if (!CategoryRecord.enforceTypeCharacters(req.type_name))\n    throw new IllegalArgumentException(\"Invalid category name: \" + req.type_name);","typeGuard":"boolean validCategory = CategoryRecord.enforceTypeCharacters(name);","tryCatchPattern":null,"preventionTips":["Validate names in the InstallCategoryRequest builder before submit.","Reuse one sanitize() helper for all category/tag names."],"tags":["bsim","validation","category","input-sanitization"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}