fix(ida): compare admitted document paths consistently
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { readFile, readdir, rm } from "node:fs/promises";
|
import { readFile, readdir, rm } from "node:fs/promises";
|
||||||
|
import { sep } from "node:path";
|
||||||
import { afterEach, describe, expect, it } from "vitest";
|
import { afterEach, describe, expect, it } from "vitest";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
@@ -111,6 +112,24 @@ describe("headless IDA producer pagination", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("attached IDA observation semantics", () => {
|
describe("attached IDA observation semantics", () => {
|
||||||
|
it("accepts a normalized spelling of the bound document path", async () => {
|
||||||
|
const { target, producer, client } = await fixture();
|
||||||
|
const equivalent =
|
||||||
|
process.platform === "win32"
|
||||||
|
? target.path.toLowerCase().replaceAll("\\", "/")
|
||||||
|
: target.path.split(sep).join(`${sep}.${sep}`);
|
||||||
|
|
||||||
|
const result = await client.execute("list_procedures", {
|
||||||
|
document: equivalent,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.ok).toBe(true);
|
||||||
|
expect(producer.calls.some(({ name }) => name === "list_functions")).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
await client.close();
|
||||||
|
});
|
||||||
|
|
||||||
it("rejects an unrelated document before connecting or opening a provider", async () => {
|
it("rejects an unrelated document before connecting or opening a provider", async () => {
|
||||||
const { producer, client } = await fixture();
|
const { producer, client } = await fixture();
|
||||||
const result = await client.execute("list_procedures", {
|
const result = await client.execute("list_procedures", {
|
||||||
|
|||||||
@@ -165,8 +165,10 @@ export class IdaSessionClient implements AnalysisClient {
|
|||||||
const document = parameters.document;
|
const document = parameters.document;
|
||||||
if (
|
if (
|
||||||
document !== undefined &&
|
document !== undefined &&
|
||||||
document !== this.target.path &&
|
(typeof document !== "string" ||
|
||||||
document !== this.target.sourcePath
|
(!sameIdaHostPath(document, this.target.path) &&
|
||||||
|
(this.target.sourcePath === undefined ||
|
||||||
|
!sameIdaHostPath(document, this.target.sourcePath))))
|
||||||
)
|
)
|
||||||
return err(
|
return err(
|
||||||
new AnalysisInputError(operation, undefined, [
|
new AnalysisInputError(operation, undefined, [
|
||||||
|
|||||||
Reference in New Issue
Block a user