mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
* refactor: prune internal seams and preserve configuration ownership * fix(setup): keep YAML aliases and inherited registration settings on refresh - Reuse an unchanged YAML collection only while every alias in it still resolves after the edit; otherwise rebuild it so the alias becomes its value. A sibling anchor replaced or moved in the same refresh no longer leaves an unresolved alias in Hermes or Goose output. - Keep a connection selector whose existing value already chooses stdio (for example an inherited Hermes transport: stdio) instead of superseding it; remote selectors are still replaced. Explicit stdio selectors are therefore no longer rewritten (Kimi expectation updated). - When the whole Hermes registration is inherited through a merge, override it with that merge and write only the changed fields. * fix(setup): edit registration fields whose YAML key is an alias A key written as an alias to a string scalar (for example *field with field: &field env) was treated as a source-only key, so any change to its value was refused in Hermes and Goose. Resolve such keys to their string, keep the aliased spelling while its anchor survives the edit, and write the plain key when the same edit rebuilds the anchor. * test(process): bound cleanup-boundary waits and always release gates Both cancellation tests awaited a bare started promise and released their gates only on success, so a missed boundary waited for the outer deadline and could leave cleanup parked. Use awaitAcknowledgement and release and join the cleanup in finally. * fix(setup): repair only aliases an edit leaves unresolved Replace the pre-edit alias survival guess, which expanded aliases to sibling anchors that survive unchanged, with an exact repair: record what each alias in the replaced value resolves to, write the edit, then replace only aliases left without a preceding anchor by that value. - Keep an aliased key's source position, so its anchor stays ahead of later aliases. - Treat an aliased key as its string only when no other key in the map resolves to the same string; an ambiguous one stays guarded. - Override an inherited Hermes registration only when the requested entry keeps every inherited field, so an explicit replacement can drop remote selectors. * fix(setup): repair aliases whose binding an edit changes, keeping comments An alias whose own anchor was removed could resolve to an earlier anchor with the same name and silently change value. Record the node each alias resolved to and repair any alias that no longer resolves to that node. Carry the alias's comments and spacing onto the repaired value. * test(setup): split the Hermes anchor and merge refresh cases * fix(setup): refuse removing an overridden key its merge would restore The merge-retention check skipped keys the mapping also overrides, so dropping such a key (for example a remote url during an explicit stdio replacement) let the retained merge restore it. Check removal before skipping overridden keys, so the edit is refused with the existing message instead of producing a registration that cannot be applied.
102 lines
6.4 KiB
TypeScript
102 lines
6.4 KiB
TypeScript
import { PeLoadConfigService } from "../application/binaryDiagnostics/PeLoadConfigService.js";
|
|
import { PeLoadConfigProvider } from "../native/pe/PeLoadConfigProvider.js";
|
|
import { BinaryHardeningService } from "../application/binaryDiagnostics/BinaryHardeningService.js";
|
|
import { BinaryHardeningProvider } from "../native/hardening/BinaryHardeningProvider.js";
|
|
import { ByteEntropyService } from "../application/binaryDiagnostics/ByteEntropyService.js";
|
|
import { RecordedCrashService } from "../application/binaryDiagnostics/RecordedCrashService.js";
|
|
import { PwntoolsRecordedCrashProvider } from "../native/pwntools/PwntoolsRecordedCrashProvider.js";
|
|
import { BinaryLayoutService } from "../application/binaryDiagnostics/BinaryLayoutService.js";
|
|
import { PwntoolsLayoutProvider } from "../native/pwntools/PwntoolsLayoutProvider.js";
|
|
import { PeResourcesService } from "../application/binaryDiagnostics/PeResourcesService.js";
|
|
import { PeResourcesProvider } from "../native/pe/PeResourcesProvider.js";
|
|
import { PeCertificatesService } from "../application/binaryDiagnostics/PeCertificatesService.js";
|
|
import { PeCertificatesProvider } from "../native/pe/PeCertificatesProvider.js";
|
|
import { PeImportsService } from "../application/binaryDiagnostics/PeImportsService.js";
|
|
import { PeImportsProvider } from "../native/pe/PeImportsProvider.js";
|
|
import { WindowsShortcutService } from "../application/binaryDiagnostics/WindowsShortcutService.js";
|
|
import { WindowsShortcutProvider } from "../native/windows/WindowsShortcutProvider.js";
|
|
import { ElfNotesService } from "../application/binaryDiagnostics/ElfNotesService.js";
|
|
import { ElfNotesProvider } from "../native/elf/ElfNotesProvider.js";
|
|
import { NativeInitializersService } from "../application/binaryDiagnostics/NativeInitializersService.js";
|
|
import { NativeInitializersProvider } from "../native/initializers/NativeInitializersProvider.js";
|
|
import { ElfUnwindRangesService } from "../application/binaryDiagnostics/ElfUnwindRangesService.js";
|
|
import { ElfUnwindRangesProvider } from "../native/elf/ElfUnwindRangesProvider.js";
|
|
import { AppleIpsService } from "../application/binaryDiagnostics/AppleIpsService.js";
|
|
import { AppleIpsProvider } from "../native/apple/AppleIpsProvider.js";
|
|
import { KernelModuleService } from "../application/binaryDiagnostics/KernelModuleService.js";
|
|
import { KernelModuleProvider } from "../native/elf/KernelModuleProvider.js";
|
|
import { KernelBuildConfigService } from "../application/binaryDiagnostics/KernelBuildConfigService.js";
|
|
import { KernelBuildConfigProvider } from "../native/elf/KernelBuildConfigProvider.js";
|
|
import type { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
|
import { NativeExportsService } from "../application/binaryDiagnostics/NativeExportsService.js";
|
|
import { NativeExportsProvider } from "../native/exports/NativeExportsProvider.js";
|
|
|
|
import { DevicetreeService } from "../application/binaryDiagnostics/DevicetreeService.js";
|
|
import { DevicetreeProvider } from "../firmware/devicetree/DevicetreeProvider.js";
|
|
export const createDevicetreeService = (): DevicetreeService =>
|
|
new DevicetreeService(new DevicetreeProvider());
|
|
|
|
/** Portable PE inspection with no engine, installation or target acquisition. */
|
|
export const createPeResourcesService = (): PeResourcesService =>
|
|
new PeResourcesService(new PeResourcesProvider());
|
|
|
|
/** Portable Authenticode table inspection with no engine or catalog verification. */
|
|
export const createPeCertificatesService = (): PeCertificatesService =>
|
|
new PeCertificatesService(new PeCertificatesProvider());
|
|
|
|
/** Portable PE import-table inspection with no engine or catalog verification. */
|
|
export const createPeImportsService = (): PeImportsService =>
|
|
new PeImportsService(new PeImportsProvider());
|
|
|
|
/** Portable Shell Link inspection with no COM, engine or target resolution. */
|
|
export const createWindowsShortcutService = (): WindowsShortcutService =>
|
|
new WindowsShortcutService(new WindowsShortcutProvider());
|
|
|
|
/** Portable PE/ELF export tables with no engine, toolchain or target acquisition. */
|
|
export const createNativeExportsService = (): NativeExportsService =>
|
|
new NativeExportsService(new NativeExportsProvider());
|
|
/** Portable ELF note-table inspection with no engine or package catalog. */
|
|
export const createElfNotesService = (): ElfNotesService =>
|
|
new ElfNotesService(new ElfNotesProvider());
|
|
|
|
/** Portable ELF and Mach-O initializer and finalizer listing with no engine. */
|
|
export const createNativeInitializersService = (): NativeInitializersService =>
|
|
new NativeInitializersService(new NativeInitializersProvider());
|
|
/** Portable ELF unwind-range inspection with no engine or disassembler. */
|
|
export const createElfUnwindRangesService = (): ElfUnwindRangesService =>
|
|
new ElfUnwindRangesService(new ElfUnwindRangesProvider());
|
|
|
|
/** Portable Apple .ips inspection with no engine, Xcode or target acquisition. */
|
|
export const createAppleIpsService = (): AppleIpsService =>
|
|
new AppleIpsService(new AppleIpsProvider());
|
|
/** Portable Linux kernel-module metadata inspection with no engine or host `modinfo`. */
|
|
export const createKernelModuleService = (): KernelModuleService =>
|
|
new KernelModuleService(new KernelModuleProvider());
|
|
/** Portable Linux kernel banner and embedded build-config inspection with no engine or host tools. */
|
|
export const createKernelBuildConfigService = (): KernelBuildConfigService =>
|
|
new KernelBuildConfigService(new KernelBuildConfigProvider());
|
|
|
|
/** Compose the offline adapter without import-time I/O or dependency acquisition. */
|
|
export const createBinaryLayoutService = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
): BinaryLayoutService =>
|
|
new BinaryLayoutService(new PwntoolsLayoutProvider(environment));
|
|
|
|
/** Compose recorded-core inspection without acquiring a debugger or toolchain. */
|
|
export const createRecordedCrashService = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
): RecordedCrashService =>
|
|
new RecordedCrashService(new PwntoolsRecordedCrashProvider(environment));
|
|
|
|
/** Provider-free local byte analysis. */
|
|
export const createByteEntropyService = (
|
|
resources?: ArtifactResourceScope,
|
|
): ByteEntropyService => new ByteEntropyService(undefined, resources);
|
|
|
|
export const createPeLoadConfigService = (): PeLoadConfigService =>
|
|
new PeLoadConfigService(new PeLoadConfigProvider());
|
|
|
|
/** Portable ELF, PE, and Mach-O hardening inspection with no engine or toolchain. */
|
|
export const createBinaryHardeningService = (): BinaryHardeningService =>
|
|
new BinaryHardeningService(new BinaryHardeningProvider());
|