ci(ghidra): add Windows P0 acceptance and real-engine lanes
Add a hosted Windows x64 lane for named host capabilities, portable provider tests, and packed CLI/MCP verification. Add a default-branch-only repository-dispatch workflow for a controlled self-hosted Ghidra 12.1.2 runner, backed by a deterministic source-owned native PE fixture and a verifier that exercises all 18 admitted operations, target digest linkage, authenticated loopback transport, and complete runtime cleanup.
This commit is contained in:
+18
-15
@@ -189,21 +189,24 @@ describe("binary target I/O", () => {
|
||||
expect((await parseBinaryTarget(app, directory, "arm64")).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects an app program symlink that leaves the bundle", async () => {
|
||||
directory = await mkdtemp(join(tmpdir(), "rea-target-"));
|
||||
const app = join(directory, "Escaping.app");
|
||||
const contents = join(app, "Contents");
|
||||
const programs = join(contents, "MacOS");
|
||||
const outside = join(directory, "outside");
|
||||
await mkdir(programs, { recursive: true });
|
||||
await writeFile(outside, thinMach(0xfeedfacf, 0x0100000c));
|
||||
await writeFile(
|
||||
join(contents, "Info.plist"),
|
||||
"<plist><dict><key>CFBundleExecutable</key><string>Escaping</string></dict></plist>",
|
||||
);
|
||||
await symlink(outside, join(programs, "Escaping"));
|
||||
expect((await parseBinaryTarget(app, directory, "arm64")).ok).toBe(false);
|
||||
});
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"rejects an app program symlink that leaves the bundle",
|
||||
async () => {
|
||||
directory = await mkdtemp(join(tmpdir(), "rea-target-"));
|
||||
const app = join(directory, "Escaping.app");
|
||||
const contents = join(app, "Contents");
|
||||
const programs = join(contents, "MacOS");
|
||||
const outside = join(directory, "outside");
|
||||
await mkdir(programs, { recursive: true });
|
||||
await writeFile(outside, thinMach(0xfeedfacf, 0x0100000c));
|
||||
await writeFile(
|
||||
join(contents, "Info.plist"),
|
||||
"<plist><dict><key>CFBundleExecutable</key><string>Escaping</string></dict></plist>",
|
||||
);
|
||||
await symlink(outside, join(programs, "Escaping"));
|
||||
expect((await parseBinaryTarget(app, directory, "arm64")).ok).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
it("honors an explicit database kind without relying on the file suffix", async () => {
|
||||
directory = await mkdtemp(join(tmpdir(), "rea-target-"));
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { parseExecutableHeader } from "../src/domain/binaryTarget.js";
|
||||
|
||||
const exec = promisify(execFile);
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const generator = resolve(root, "scripts", "create-ghidra-windows-fixture.mjs");
|
||||
const fixture = resolve(root, "build", "fixtures", "rea-ghidra-windows.exe");
|
||||
const expectedSha256 =
|
||||
"732ec6083ae3b63bcbda33f2d0fd7e1a6539babade07cbdae4fc20d3394faf49";
|
||||
|
||||
describe("controlled Windows Ghidra fixture", () => {
|
||||
it("generates one deterministic native x86-64 PE application", async () => {
|
||||
await exec(process.execPath, [generator]);
|
||||
const bytes = await readFile(fixture);
|
||||
|
||||
expect(createHash("sha256").update(bytes).digest("hex")).toBe(
|
||||
expectedSha256,
|
||||
);
|
||||
expect(parseExecutableHeader(bytes, "x64")).toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
format: "pe",
|
||||
architecture: "x86_64",
|
||||
executableRole: "application",
|
||||
managed: false,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("real Windows Ghidra workflow trust boundary", () => {
|
||||
it("runs only default-branch code on the fixed self-hosted environment", async () => {
|
||||
const workflow = await readFile(
|
||||
new URL("../.github/workflows/real-ghidra-windows.yml", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
expect(workflow).toContain("types: [real-ghidra-windows]");
|
||||
expect(workflow).not.toContain("workflow_dispatch:");
|
||||
expect(workflow).toContain("contents: read");
|
||||
expect(workflow).toContain("if: github.ref == 'refs/heads/main'");
|
||||
expect(workflow).toContain("environment: real-ghidra-windows");
|
||||
expect(workflow).toContain(
|
||||
"runs-on: [self-hosted, Windows, x64, ghidra-12-1-2]",
|
||||
);
|
||||
expect(workflow).not.toMatch(
|
||||
/\$\{\{\s*(?:inputs|github\.event\.(?:inputs|client_payload))\b/u,
|
||||
);
|
||||
expect(workflow).not.toContain("cache: npm");
|
||||
expect(workflow).toContain("npm run verify:ghidra:windows");
|
||||
expect(workflow).toContain("windows-ghidra-proof.log");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user