mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 03:33:25 +00:00
* feat(javascript): make the member-mutation work allowance a runtime setting The member-mutation alias-state allowance from #11144 was a fixed constant, so a refused source could not be admitted without a code change. Register javascript.member_mutation_alias_states (default 524288, 1 to 8388608 alias states) with the launch seed REA_JAVASCRIPT_MEMBER_MUTATION_ALIAS_STATES. The application, web bundle and reference-source boundaries resolve it from the accepted operation snapshot and launch environment, refuse a malformed seed before analysis, and send it to the workers with each source. A refusal names the setting, its effective value, source and range, and the recovery; worker parents rebuild it from the allowance they sent. Refs #8294 * fix(javascript): keep the setting and recovery of a refused web script A web bundle script refused by the member-mutation allowance kept only its reason and reported limits, so the public unknown lost the setting, value, source and recovery. Carry the refusal's structured limit and remediation on the per-script result and its javascript_analysis unknown, grouping scripts only when that recovery agrees. Assert structured limit facts and the owning formatter's recovery instead of fixed wording. * fix(browser): keep only registered setting limits on a refused web script * feat(javascript): keep syntax facts for a source whose member-mutation phase is refused (#11187) * feat(javascript): keep syntax facts for a source whose member-mutation phase is refused A source refused by the member-mutation work allowance during static analysis lost every fact, so the application graph counted it as skipped. Reference-source import failed outright on such a file. Checkpoint the parser, comment and text facts the static owner can still state, with parse status partial, examination not-examined and refused_phase member-mutations, before reporting the refusal; the semantic phase is not started because it indexes the same mutations. Reference-source import keeps the file's declaration-level imports and records that its CommonJS require calls were not examined. Refs #8294 * test(javascript): compare the reference-source refusal with its owning formatter * feat(javascript): keep a refused web script's parse and text facts A captured script whose member-mutation phase was refused lost every fact in analyze_web_bundle, so it was neither counted as parsed nor kept its vendor markers. The analyzer now returns the script as unavailable with partial facts: refused phase, parse status and the inferences read from script text alone. Findings gathered before the refusal are dropped, because they may have read an incomplete mutation index. The worker parent states the refusal and its setting recovery from the allowance it sent, through the same helper the isolated analyzer uses for every unavailable script. The bundle counts the script as parsed, keeps its text inferences, and its javascript_analysis unknown carries refused_phase. Refs #8294 * chore(mcp): record the member-mutation setting in the advertised summary * fix(javascript): rebuild a parked source worker when the member-mutation allowance changes A worker parked on a resource scope was reused when heap, timeout and precision matched, but its requests carry the allowance it was built with. After update_analysis_settings accepted a new allowance, the next analysis on that scope kept the old one. The reuse check now compares the allowance's value and source, so a changed setting gets a worker built with it. The web bundle worker already takes the allowance per script.
119 lines
5.0 KiB
TypeScript
119 lines
5.0 KiB
TypeScript
/** Runtime policy overrides, separate from target state and launch environment. */
|
|
export interface AnalysisSettingValues {
|
|
readonly "asar.max_header_bytes": number;
|
|
readonly "asar.max_listing_bytes": number;
|
|
readonly "ghidra.value_flow_max_operations": number;
|
|
readonly "ghidra.value_flow_max_inputs_per_operation": number;
|
|
readonly "ghidra.value_flow_max_edges": number;
|
|
readonly "ghidra.startup_timeout_ms": number;
|
|
readonly "hopper.startup_timeout_ms": number;
|
|
readonly "ghidra.decompile_timeout_seconds": number | null;
|
|
readonly "ghidra.decompile_max_payload_mib": number | null;
|
|
readonly "jadx.operation_timeout_ms": number;
|
|
readonly "regex.matching_deadline_ms": number;
|
|
readonly "regex.worker_heap_request_mib": number;
|
|
readonly "capture.decoder_old_generation_mib": number;
|
|
readonly "capture.packet_json_expansion_bytes": number;
|
|
readonly "javascript.analysis_timeout_ms": number;
|
|
readonly "javascript.max_heap_mb": number;
|
|
readonly "javascript.member_mutation_alias_states": number;
|
|
readonly "wasm.command_timeout_ms": number;
|
|
readonly "native.matching_representation_bytes": number;
|
|
readonly "bridge.max_request_bytes": number;
|
|
readonly "bridge.max_reply_bytes": number;
|
|
readonly "debugger.command_deadline_ms": number;
|
|
readonly "debugger.max_command_output_bytes": number;
|
|
readonly "hopper.caller_scan_budget_ms": number;
|
|
readonly "jeb.mcp_timeout_ms": number;
|
|
readonly "kuna.project_timeout_ms": number;
|
|
readonly "kuna.function_timeout_ms": number;
|
|
readonly "pwntools.max_input_bytes": number;
|
|
readonly "windows.change_time_drift_ms": number;
|
|
readonly "windows.change_time_settle_poll_ms": number;
|
|
readonly "windows.change_time_settle_max_polls": number;
|
|
}
|
|
export type AnalysisSettingId = keyof AnalysisSettingValues;
|
|
export interface AnalysisSettingsSnapshot {
|
|
readonly revision: number;
|
|
readonly overrides: Readonly<Partial<AnalysisSettingValues>>;
|
|
}
|
|
/** Injected by the runtime owner; reads the accepted operation's immutable snapshot. */
|
|
export type AnalysisSettingsReader = () => AnalysisSettingsSnapshot;
|
|
|
|
/**
|
|
* Whether `update_analysis_settings` can change the active value.
|
|
* `runtime` applies inside this process. `restart` stays at the value this
|
|
* process already started with. A limit fact uses `parameter` when its value
|
|
* is adjustable through a per-call argument; its source is recorded separately.
|
|
*/
|
|
export type AnalysisSettingUpdateMode = "runtime" | "restart";
|
|
|
|
/** Limit facts supplied by the failing owner, never inferred from error prose. */
|
|
export interface AnalysisSettingLimit {
|
|
readonly setting: AnalysisSettingId;
|
|
readonly effective_value: number | null;
|
|
readonly unit: "bytes" | "ms" | "seconds" | "MiB" | "count";
|
|
readonly minimum: number;
|
|
readonly maximum: number;
|
|
readonly source?: "default" | "setting" | "runtime" | "request";
|
|
readonly applies_at: "next_operation" | "next_worker" | "next_startup";
|
|
readonly agent_editable: true;
|
|
readonly scope: "rea-runtime";
|
|
readonly update_mode: AnalysisSettingUpdateMode | "parameter";
|
|
/**
|
|
* True only when a configured value is not the one this process is using.
|
|
* The reported effective value is active, so limit errors leave this false.
|
|
*/
|
|
readonly pending_restart: false;
|
|
readonly required_value?: number;
|
|
readonly parameter?: string;
|
|
}
|
|
|
|
/**
|
|
* The same limit for a caller whose REA runtime ended with one invocation. No
|
|
* runtime override can reach it; a new invocation reads the launch
|
|
* environment seed or the per-call argument. The caller can still choose that
|
|
* value, and no running REA process needs a restart.
|
|
*/
|
|
export interface AnalysisInvocationSettingLimit extends Omit<
|
|
AnalysisSettingLimit,
|
|
"applies_at" | "scope"
|
|
> {
|
|
readonly applies_at: "next_invocation";
|
|
readonly scope: "rea-invocation";
|
|
/** Launch-environment seed that a new invocation reads, when one exists. */
|
|
readonly environment?: string;
|
|
}
|
|
|
|
/**
|
|
* A limit whose control is not a registered analysis setting: a per-call
|
|
* request parameter, or an environment variable REA reads when it starts. A
|
|
* limit without `control_kind` is an `AnalysisSettingLimit` named by
|
|
* `setting`. `update_analysis_settings` changes neither control.
|
|
*/
|
|
export type AnalysisControlLimit = {
|
|
readonly effective_value: number;
|
|
readonly unit: AnalysisSettingLimit["unit"];
|
|
readonly minimum: number;
|
|
readonly maximum: number;
|
|
/** Value used when the control is omitted. */
|
|
readonly default_value: number;
|
|
} & (
|
|
| {
|
|
readonly control_kind: "parameter";
|
|
readonly parameter: string;
|
|
/** CLI spelling of the same per-call parameter. */
|
|
readonly cli_flag: string;
|
|
readonly applies_at: "next_call";
|
|
}
|
|
| {
|
|
readonly control_kind: "environment";
|
|
readonly environment: string;
|
|
/** A one-invocation caller's next invocation reads it without a restart. */
|
|
readonly applies_at: "next_startup" | "next_invocation";
|
|
}
|
|
);
|
|
|
|
/** The limit an error binds: a registered setting, or a parameter or environment control. */
|
|
export type AnalysisLimit = AnalysisSettingLimit | AnalysisControlLimit;
|