mirror of
https://github.com/morluto/rea.git
synced 2026-10-30 11:25:39 +00:00
Summarize saved Wireshark4.x captures with enforced native resource limits, serialized admission, stable snapshot verification and retained fact/text pages. Preserve complete inventories within resource budgets and source uncertainty; report cleanup failure with partial Evidence and retained ownership. Verified six recorded corpora /13026 packets with independent Scapy/Python oracles, real CLI/MCP/schema parity,60 SNI names,132 DNS addresses and1000 URIs. Real TShark CI now exercises summary/paging. Actual Windows/Bun Wireshark remains unverified; macOS capture requires a separate enforceable-bound decision. Co-authored-by: 3QL <85309073+3QL@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { setTimeout as delay } from "node:timers/promises";
|
|
import { expect, it, onTestFinished, vi } from "vitest";
|
|
import { runPcapCommand } from "../../../src/pcap/PcapCommand.js";
|
|
import * as ownership from "../../../src/process/ProcessOwnershipObservation.js";
|
|
|
|
it("does not spend the tool execution deadline preparing native ownership", async () => {
|
|
const original = ownership.prepareProcessOwnershipInspection;
|
|
let entered!: () => void;
|
|
let release!: () => void;
|
|
const preparing = new Promise<void>((resolve) => {
|
|
entered = resolve;
|
|
});
|
|
const gate = new Promise<void>((resolve) => {
|
|
release = resolve;
|
|
});
|
|
let first = true;
|
|
const prepare = vi
|
|
.spyOn(ownership, "prepareProcessOwnershipInspection")
|
|
.mockImplementation(async (signal) => {
|
|
await original(signal);
|
|
if (first) {
|
|
first = false;
|
|
entered();
|
|
await gate;
|
|
}
|
|
});
|
|
onTestFinished(() => {
|
|
prepare.mockRestore();
|
|
release();
|
|
});
|
|
const pending = runPcapCommand({
|
|
operation: "inspect_pcap_client",
|
|
command: process.execPath,
|
|
arguments: ["--version"],
|
|
limits: { timeoutMs: 1000, maxOutputBytes: 1024 },
|
|
environment: {},
|
|
signal: undefined,
|
|
retain: (owner) => {
|
|
onTestFinished(async () => {
|
|
expect((await owner.stop()).status).not.toBe("incomplete");
|
|
});
|
|
},
|
|
}).then(
|
|
(value) => ({ ok: true as const, value }),
|
|
(error: unknown) => ({ ok: false as const, error }),
|
|
);
|
|
await preparing;
|
|
await delay(1100);
|
|
release();
|
|
const result = await pending;
|
|
if (!result.ok) throw result.error;
|
|
expect(result.value.stdout.trim()).toBe(process.version);
|
|
});
|