mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
* fix(objdump): reflect observed launch failure in discovery availability Distinguish a statically registered standalone command from an executable whose launch has failed in the active server session. Discovery leaves unprobed commands optimistically available, reports an observed launch failure as provider_unavailable with the command remediation, keeps the tool callable for retries, and clears the failure after a subsequent successful launch. Fixes #8826. * test(reverse): verify overlapping command launch dispatch ordering * test(reverse): unblock gated test workers before awaiting service closure * test(reverse): bound lifecycle acknowledgement and join launched workers * fix(reverse): distinguish host capacity exhaustion from command launch failures * fix(reverse): preserve host capacity across Linux process ownership preparation * fix(reverse): exclude process ownership admission failures from command launch state * fix(reverse): preserve Darwin process ownership preparation error across command launch * fix(reverse): disambiguate cleanup declaration in provider observation * fix(reverse): preserve command deadline timeout during Darwin ownership preparation * fix(reverse): isolate Darwin baseline ps errors and provide platform-aware admission guidance * fix(reverse): rely on typed baseline admission failures and use owning repair formatter in tests * test(reverse): use owning formatters for process ownership remediation assertions * fix(reverse): restrict Linux ownership prerequisite remediation to missing ps and preserve system error codes * fix(reverse): retain typed process ownership prerequisite with preserved error codes * fix(reverse): remove unvalidated error label fallbacks and keep admission tags out of system_code * fix(reverse): keep Windows native runner failures out of command-launch state * fix(process): preserve current_process_unreported refusal in Linux provider readiness * fix(process): distinguish no-code ps failure from missing ps and cover rizin launch failure * fix(windows): classify process_spawn host-control rejections as RuntimeControlUnavailableError
114 lines
3.7 KiB
TypeScript
114 lines
3.7 KiB
TypeScript
import {
|
|
systemWindowsNativeAuthority,
|
|
windowsNativeFailureRemediation,
|
|
type WindowsNativeLoadResult,
|
|
} from "../windows/WindowsNativeLoader.js";
|
|
|
|
/** Windows controls are proven by the packaged native boundary, not POSIX flags. */
|
|
export type WindowsNativeCapability =
|
|
| {
|
|
readonly available: true;
|
|
readonly reason: null;
|
|
readonly proof: "native-authority";
|
|
}
|
|
| {
|
|
readonly available: false;
|
|
readonly reason: string;
|
|
readonly proof: "not-proven" | "not-applicable";
|
|
readonly retryable?: true;
|
|
readonly code:
|
|
| "unsupported_host"
|
|
| "runtime_missing"
|
|
| "runtime_unavailable";
|
|
readonly failureStage: Exclude<
|
|
WindowsNativeLoadResult,
|
|
{ available: true }
|
|
>["failureStage"];
|
|
readonly remediation: string;
|
|
};
|
|
|
|
/** Security controls required before REA may claim Windows isolation. */
|
|
export interface WindowsNativeCapabilitySet {
|
|
readonly job_object_process_ownership: WindowsNativeCapability;
|
|
readonly private_runtime_dacl: WindowsNativeCapability;
|
|
readonly reparse_safe_path_admission: WindowsNativeCapability;
|
|
}
|
|
|
|
/** One readiness observation, shared by diagnostics and security controls. */
|
|
export type WindowsNativeReadiness =
|
|
| { readonly available: true }
|
|
| {
|
|
readonly available: false;
|
|
readonly reason: string;
|
|
readonly failureStage: Exclude<
|
|
WindowsNativeLoadResult,
|
|
{ available: true }
|
|
>["failureStage"];
|
|
readonly code:
|
|
| "unsupported_host"
|
|
| "runtime_missing"
|
|
| "runtime_unavailable";
|
|
readonly retryable?: true;
|
|
readonly remediation: string;
|
|
readonly proof: "not-proven" | "not-applicable";
|
|
};
|
|
|
|
/** Interpret the loader's tagged failure without guessing from OS error text. */
|
|
export const inspectWindowsNativeReadiness = (
|
|
platform: NodeJS.Platform,
|
|
observation?: WindowsNativeLoadResult,
|
|
): WindowsNativeReadiness => {
|
|
if (platform !== "win32")
|
|
return {
|
|
available: false,
|
|
failureStage: "host",
|
|
reason: "Windows native authority is not applicable on this host",
|
|
proof: "not-applicable",
|
|
code: "unsupported_host",
|
|
remediation: "Use a Windows x64 host for Windows native controls.",
|
|
};
|
|
const loaded = observation ?? systemWindowsNativeAuthority();
|
|
if (loaded.available) return { available: true };
|
|
const failureStage = loaded.failureStage;
|
|
return {
|
|
available: false,
|
|
failureStage,
|
|
reason: loaded.reason,
|
|
...(loaded.retryable === true ? { retryable: true as const } : {}),
|
|
proof: "not-proven",
|
|
code:
|
|
failureStage === "host"
|
|
? "unsupported_host"
|
|
: failureStage === "artifact" || failureStage === "load"
|
|
? "runtime_missing"
|
|
: "runtime_unavailable",
|
|
remediation: windowsNativeFailureRemediation(failureStage),
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Describe native Windows controls without inferring them from taskkill,
|
|
* chmod, symlink creation, or a numeric POSIX open flag.
|
|
*/
|
|
export const windowsNativeCapabilities = (
|
|
platform: NodeJS.Platform,
|
|
readiness: WindowsNativeReadiness = inspectWindowsNativeReadiness(platform),
|
|
): WindowsNativeCapabilitySet => {
|
|
const capability = readiness.available
|
|
? ({ available: true, reason: null, proof: "native-authority" } as const)
|
|
: ({
|
|
available: false,
|
|
reason: readiness.reason,
|
|
proof: readiness.proof,
|
|
code: readiness.code,
|
|
failureStage: readiness.failureStage,
|
|
remediation: readiness.remediation,
|
|
...(readiness.retryable === true ? { retryable: true as const } : {}),
|
|
} as const);
|
|
return {
|
|
job_object_process_ownership: capability,
|
|
private_runtime_dacl: capability,
|
|
reparse_safe_path_admission: capability,
|
|
};
|
|
};
|