fix(cli): reject empty native and managed targets before resolution (#7956)

Local file commands in the core binary, native, managed and native-tool
CLI groups declared their positional target as a plain string. An empty
argument therefore reached path admission, where it resolved to the
working directory, as docs/cli.md says it never should.

Declare those targets with the shared nonempty, NUL-free local path
schema already used by analyze, so the CLI rejects them as a
VALIDATION_ERROR naming the field before any analysis runner is called.
Explicit "." is unchanged.

Fixes #7436
Fixes #7404
This commit is contained in:
RRFZ authored and GitHub committed 2026-10-29 08:31:12 +08:00
1 parent 4671947c97
commit 6db024dc96
5 files changed
+174 -26

No files matched your search

+15 -5
View File
@@ -41,7 +41,9 @@ const registerInspectManagedArtifact = (
cli.command(CLI_COMMANDS.inspectManagedArtifact, {
description: "Inspect PE/CLI identity without loading target code",
args: z.object({
path: z.string().describe("Managed PE executable or assembly path"),
path: localPathStringSchema.describe(
"Managed PE executable or assembly path",
),
}),
run: ({ args }) =>
logCliCommand(logger, "inspect-managed-artifact", () =>
@@ -64,7 +66,9 @@ const registerInspectManagedMembers = (
description:
"Inspect PE/CLI metadata members, signatures, CIL anchors, and ldstr string literals without loading target code",
args: z.object({
path: z.string().describe("Managed PE executable or assembly path"),
path: localPathStringSchema.describe(
"Managed PE executable or assembly path",
),
}),
options: z.object({
type: managedMembersInputSchema.shape.type_names.describe(
@@ -111,7 +115,9 @@ const registerInspectManagedNativeBoundaries = (
description:
"Inspect PE/CLI PInvoke and native implementation boundary declarations without loading target code",
args: z.object({
path: z.string().describe("Managed PE executable or assembly path"),
path: localPathStringSchema.describe(
"Managed PE executable or assembly path",
),
}),
run: ({ args }) =>
logCliCommand(logger, "inspect-managed-native-boundaries", () =>
@@ -126,8 +132,12 @@ const registerInspectManagedNativeBoundaries = (
};
const compareManagedMemberArgs = z.object({
leftPath: z.string().describe("Baseline managed PE executable or assembly"),
rightPath: z.string().describe("Candidate managed PE executable or assembly"),
leftPath: localPathStringSchema.describe(
"Baseline managed PE executable or assembly",
),
rightPath: localPathStringSchema.describe(
"Candidate managed PE executable or assembly",
),
});
const registerCompareManagedMembers = (