fix(firmware): accept the verified Binwalk and Unblob release lines (#844)
* fix(firmware): accept the verified Binwalk and Unblob release lines Exact --version equality rejected every build except Binwalk 3.1.0 and Unblob 26.6.4, then stored that constant as the observed engine version. Admit the 3.1 and 26.6 lines, keep the audited build as verified, and report the banner that actually ran. * chore(docs): regenerate skill metadata after firmware contract text docs:check failed because SKILL.md lagged the Binwalk/Unblob release-line tool descriptions. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
@@ -340,6 +340,37 @@ it("retains an uncertain workspace and blocks new launches after cleanup failure
|
||||
expect(fixture.launches).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("accepts another build on the verified release line and reports it", async () => {
|
||||
const fixture = await firmwareFixture("normal", "binwalk 3.1.2");
|
||||
const result = await fixture.service.execute("inspect_firmware_regions", {
|
||||
path: fixture.path,
|
||||
});
|
||||
if (!result.ok) throw result.error;
|
||||
expect(result.value.provider.version).toBe("3.1.2");
|
||||
expect(result.value.limitations.join("\n")).toContain(
|
||||
"verified against 3.1.0",
|
||||
);
|
||||
expect(result.value.normalized_result).toMatchObject({
|
||||
engine: { version: "3.1.2" },
|
||||
});
|
||||
await assertFirmwareCleanup(fixture.launches);
|
||||
});
|
||||
|
||||
it("names the accepted release line when the banner is another line", async () => {
|
||||
const fixture = await firmwareFixture("normal", "binwalk 3.2.0");
|
||||
const result = await fixture.service.execute("inspect_firmware_regions", {
|
||||
path: fixture.path,
|
||||
});
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "AnalysisCapabilityUnavailableError",
|
||||
reason: expect.stringContaining("Binwalk 3.1.x"),
|
||||
},
|
||||
});
|
||||
await assertFirmwareCleanup(fixture.launches);
|
||||
});
|
||||
|
||||
it("rejects absent or unsupported engines without installing anything", async () => {
|
||||
const missing = await new FirmwareAnalysisService(
|
||||
new FirmwareProvider({}),
|
||||
|
||||
Vendored
+6
-3
@@ -4,13 +4,16 @@ import { join } from "node:path";
|
||||
const args = process.argv.slice(2);
|
||||
const mode = process.env.REA_FIRMWARE_FIXTURE_MODE;
|
||||
const engine = process.env.REA_FIRMWARE_FIXTURE_ENGINE;
|
||||
const banner = process.env.REA_FIRMWARE_FIXTURE_VERSION;
|
||||
if (args.includes("--version")) {
|
||||
console.log(
|
||||
mode === "version"
|
||||
? "unsupported"
|
||||
: engine === "binwalk"
|
||||
? "binwalk 3.1.0"
|
||||
: "26.6.4",
|
||||
: banner !== undefined && banner.length > 0
|
||||
? banner
|
||||
: engine === "binwalk"
|
||||
? "binwalk 3.1.0"
|
||||
: "26.6.4",
|
||||
);
|
||||
} else if (mode === "stall") {
|
||||
setInterval(() => {}, 1000);
|
||||
|
||||
Vendored
+4
-1
@@ -8,7 +8,7 @@ import { spawnOwnedProviderProcess } from "../../../src/process/ProviderProcess.
|
||||
import { createTestTempDirectory } from "../temporaryDirectory.js";
|
||||
|
||||
/** Exercise real subprocess ownership with synthetic pinned producer representations. */
|
||||
export const firmwareFixture = async (mode = "normal") => {
|
||||
export const firmwareFixture = async (mode = "normal", banner?: string) => {
|
||||
const root = await createTestTempDirectory("rea-firmware-test-");
|
||||
const path = join(root, "input.bin");
|
||||
await writeFile(path, Buffer.from("fixture-input-data"));
|
||||
@@ -43,6 +43,9 @@ export const firmwareFixture = async (mode = "normal") => {
|
||||
...options.env,
|
||||
REA_FIRMWARE_FIXTURE_MODE: mode,
|
||||
REA_FIRMWARE_FIXTURE_ENGINE: engine,
|
||||
...(banner === undefined
|
||||
? {}
|
||||
: { REA_FIRMWARE_FIXTURE_VERSION: banner }),
|
||||
},
|
||||
});
|
||||
launches.push({
|
||||
|
||||
Reference in New Issue
Block a user