feat(native): admit raw binaries with caller-supplied architecture and entry (#1868)
* feat(native): admit raw binaries with caller-supplied architecture and entry * fix(native): honor raw-binary preparation and entry identity * fix(ghidra): stream raw snapshot attestation with cancellation * fix(native): preserve and validate raw lifecycle entries --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { openBinaryInputSchema } from "./sessionLifecycleInputs.js";
|
||||
|
||||
describe("open_binary raw-binary input contract", () => {
|
||||
it("accepts header detection without architecture", () => {
|
||||
expect(
|
||||
openBinaryInputSchema.safeParse({ path: "/tmp/fixture.bin" }).success,
|
||||
).toBe(true);
|
||||
expect(
|
||||
openBinaryInputSchema.safeParse({
|
||||
path: "/tmp/legacy.com",
|
||||
format: "dos-com",
|
||||
}).success,
|
||||
).toBe(true);
|
||||
});
|
||||
it("accepts raw-binary with architecture and entry", () => {
|
||||
expect(
|
||||
openBinaryInputSchema.safeParse({
|
||||
path: "/tmp/ecu.bin",
|
||||
format: "raw-binary",
|
||||
architecture: "arm",
|
||||
entry_point: "0x8000000",
|
||||
}).success,
|
||||
).toBe(true);
|
||||
});
|
||||
it("rejects raw-binary without architecture or entry", () => {
|
||||
const parsed = openBinaryInputSchema.safeParse({
|
||||
path: "/tmp/ecu.bin",
|
||||
format: "raw-binary",
|
||||
});
|
||||
expect(parsed.success).toBe(false);
|
||||
expect(
|
||||
openBinaryInputSchema.safeParse({
|
||||
path: "/tmp/ecu.bin",
|
||||
format: "raw-binary",
|
||||
architecture: "arm",
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
it("rejects architecture without format=raw-binary", () => {
|
||||
expect(
|
||||
openBinaryInputSchema.safeParse({
|
||||
path: "/tmp/ecu.bin",
|
||||
architecture: "arm",
|
||||
entry_point: "0x8000000",
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user