feat(analysis): make resource budgets recoverable across CLI and MCP (#9706)

* refactor(analysis): centralize resource budgets and recovery facts

* feat(analysis): expose ASAR and Ghidra runtime admission controls

* feat(artifacts): expose reader admission and preserve limited recognition

* feat(javascript): expose recoverable semantic precision budgets

* feat(web): add recoverable source-map budgets and compact retained views

* feat(web): make historical capture decoding budgets recoverable

* fix(desktop): enforce selected view policies across capture and export

* feat(runtime): make Frida and LLDB retention budgets selectable

* feat(native): expose diagnostic budgets and preserve exhaustion causes

* feat(managed): expose recoverable snapshot and representation budgets

* feat(metadata): make Go and Rust inspection budgets recoverable

* feat(wasm): expose representation and producer admissions

* feat(evm): expose per-call worker resource budgets

* feat(android): make resource and string-pool omissions recoverable

* feat(producers): expose command and recorded-capture budgets

* docs(analysis): record recovery contracts and integrated validation

* fix(docs): link calibration oracle from published verification pages

* fix(docs): restore desktop task anchors and receipt links

* test(analysis): align fixtures with selectable budget contracts

* fix(analysis): remove source-location projector dependency cycle

* test(analysis): refresh budget recovery and verifier regressions

* test(analysis): preserve format and publication recovery expectations

* test(windows): align conformance with owned runtime admission

* fix(desktop): preserve selected alias kinds in exported state

* test(analysis): align provider fixtures with recoverable budgets

* test(desktop): validate emitted alias metadata structurally

* fix(ghidra): classify bounded Windows endpoint refusals

* test(cli): assert selectable artifact admission recovery

* fix(cli): preserve capture provenance in environment builds
This commit is contained in:
morluto authored and GitHub committed 2026-11-10 05:11:20 -05:00
1 parent 55b6d2ca20
commit cb4e5cfbff
515 files changed
+21066 -3637

No files matched your search

+15 -8
View File
@@ -1,3 +1,7 @@
import {
BOUNDED_PRODUCER_LIMITS as LIMITS,
resolveProducerLimits,
} from "../domain/producerResourceLimits.js";
import { TSHARK_PROVIDER_IDENTITY } from "./TsharkProviderIdentity.js";
import { artifactFileCancellationCause } from "../artifacts/ArtifactFileOperation.js";
import {
@@ -10,7 +14,6 @@ import {
FIELD_RECORD_BUDGET,
} from "./parseFieldDiscovery.js";
import {
BOUNDED_PRODUCER_LIMITS as LIMITS,
prlimitArgumentVector,
readLinuxResourceLimits,
type LinuxResourceLimits,
@@ -131,8 +134,10 @@ export class TsharkCaptureProvider implements PacketCapturePort {
): Promise<Result<AnalysisExecution, AnalysisError>> {
const operation = "path" in input ? OPERATION : "inspect_packet_fields";
// TShark 4.6.9 emits a 22.3 MB glossary; keep capture output capped at 4 MiB.
const limits =
"path" in input ? LIMITS : { ...LIMITS, output_bytes: 32 * 1024 * 1024 };
const limits = resolveProducerLimits(
"path" in input ? LIMITS : { ...LIMITS, output_bytes: 32 * 1024 * 1024 },
input.producer_limits,
);
let phase: "configuration" | "workspace" | "producer" | "integrity" =
"configuration";
let capturedOutput: AnalysisCapturedOutput | undefined;
@@ -308,15 +313,16 @@ export class TsharkCaptureProvider implements PacketCapturePort {
limitations: [
"Protocol and field registrations describe the selected installation, not traffic observed in a capture. Duplicate abbreviations remain distinct producer records with source line numbers.",
"Each request probes again without caching. The private empty personal profile does not fingerprint or isolate installed libraries, global configuration or plugins; they remain trusted.",
"No capture file, interface or device is opened. Resource ceilings do not constitute an OS sandbox. Glossary output is capped at 32 MiB and selected record representation at 8 MiB before expansion.",
"No capture file, interface or device is opened. Resource ceilings do not constitute an OS sandbox. Selected producer output budget is reported in limits.output_bytes and can be changed with producer_limits.output_bytes. Selected record representation remains independently capped at 8 MiB before expansion.",
],
}),
);
} else {
const selected = await this.#resources.readSelectedArtifact({
path: input.path,
maximumBytes: LIMITS.input_bytes,
allowanceName: "the fixed packet-capture input allowance",
maximumBytes: limits.input_bytes,
allowanceName: "the packet-capture input allowance",
budgetParameter: "producer_limits.input_bytes",
observedOutput: capturedOutput,
signal: options?.signal,
});
@@ -350,7 +356,7 @@ export class TsharkCaptureProvider implements PacketCapturePort {
phase = "integrity";
resourcePath = snapshotPath;
if (
(await this.#resources.read(snapshotPath, LIMITS.input_bytes))
(await this.#resources.read(snapshotPath, limits.input_bytes))
.sha256 !== selected.sha256
)
throw new AnalysisArtifactChangedError(
@@ -402,7 +408,7 @@ export class TsharkCaptureProvider implements PacketCapturePort {
"Packet limits count input packets before display filtering. Filtered results do not establish whole-capture or device traffic absence. Two-pass reassembly cannot recover bytes missing from the recording or beyond the read limit.",
"Repeated field values remain ordered string arrays; raw packet bytes are included only when explicitly selected as a supported field. Export index/score metadata are omitted. All stderr, including warnings on exit zero, is retained.",
"A private empty personal configuration is used. Installed libraries, global configuration and dissector plugins are trusted and not fully fingerprinted. File-only analysis and disabled name resolution do not constitute an OS sandbox.",
"Linux prlimit enforces soft and hard ceilings before execution, preserving stricter inherited limits: at most 1 GiB address space per process, 64 MiB per file, 30 CPU seconds and no core dumps. Effective limits are reported. Resident input is capped at 32 MiB, each command at 30 wall-clock seconds and combined output at 4 MiB. Output overflow fails. These are per-process/per-file limits, not aggregate memory or filesystem quotas; caller-supplied tools and the limiter are trusted. REA retains the tighter inherited limit. This release has no runtime override.",
"Linux prlimit enforces the reported per-process address-space, per-file and CPU limits before execution with no core dumps, preserving tighter inherited soft and hard limits. Input, command deadline and retained output budgets are reported in limits; producer_limits can change their requested defaults on the next call without restart. Output overflow fails. Parser and transport bounds remain independent. These are per-process/per-file limits, not aggregate memory or filesystem quotas; caller-supplied tools and the limiter are trusted.",
],
}),
);
@@ -504,6 +510,7 @@ export class TsharkCaptureProvider implements PacketCapturePort {
limits,
effectiveLimits,
operation,
"producer_limits",
);
if (phase === "workspace")
return privateWorkspaceFailure(