fix(config): treat a blank analyzer override as absent beside an existing Ghidra project (#7923)
REA_GHIDRA_DISABLED_ANALYZERS parses a blank or comma-only value to no override, but the existing-project conflict check tested the raw value. MCP startup exited and doctor reported config_drift for an input that selects nothing. The check now uses the parsed value. Fixes #7422
This commit is contained in:
1 parent
32b3722d2f
commit
bbd4989654
2 files changed
+23
-1
No files matched your search
@@ -236,7 +236,13 @@ export const parseEnvironment = (
|
||||
"REA_GHIDRA_SEED_FILE",
|
||||
"REA_GHIDRA_DISABLED_ANALYZERS",
|
||||
"REA_GHIDRA_NATIVEAOT_JAR",
|
||||
].filter((setting) => environment[setting] !== undefined);
|
||||
].filter(
|
||||
(setting) =>
|
||||
// Blank analyzer lists parse to no override, so they cannot conflict.
|
||||
(setting === "REA_GHIDRA_DISABLED_ANALYZERS"
|
||||
? env[setting]
|
||||
: environment[setting]) !== undefined,
|
||||
);
|
||||
if (incompatible.length > 0)
|
||||
return err(
|
||||
new ConfigurationError("Invalid existing Ghidra project configuration", {
|
||||
|
||||
@@ -114,6 +114,22 @@ it("parses an opt-in project once for shared CLI/MCP configuration and rejects i
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts a blank analyzer override beside an existing project and rejects a named one", () => {
|
||||
const environment = {
|
||||
REA_GHIDRA_PROJECT_PATH: join(process.cwd(), "existing.gpr"),
|
||||
};
|
||||
for (const blank of ["", " ", ", ,"])
|
||||
expect(
|
||||
parseConfig({ ...environment, REA_GHIDRA_DISABLED_ANALYZERS: blank }).ok,
|
||||
).toBe(true);
|
||||
expect(
|
||||
parseConfig({
|
||||
...environment,
|
||||
REA_GHIDRA_DISABLED_ANALYZERS: "Decompiler Parameter ID",
|
||||
}).ok,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("reports an invalid derived program name at its selection boundary", async () => {
|
||||
const { source } = await fixture();
|
||||
await expect(
|
||||
|
||||
Reference in new issue
Block a user