mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 04:34:13 +00:00
refactor: consolidate binary analysis admission and format ownership
Reuse the existing provider input admission helper across twelve services, preserving cancellation, schema errors, path policies, and Evidence handling. Share ELF dynamic records across Dart, MIPS, and IL2CPP readers, and reuse Mach-O segment and section records for Node SEA location. Require canonical DOS ownership before GPU PE section discovery so relocation bytes cannot masquerade as a PE pointer. Cover valid short DOS headers and the malformed case through both inventory and the public CLI.
This commit is contained in:
1 parent
7adfcc4467
commit
6336fe5bb5
23 files changed
+482
-270
No files matched your search
@@ -14,7 +14,6 @@ import {
|
||||
AnalysisResourceConstraintError,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import { createEvidence, type Evidence } from "../../domain/evidence.js";
|
||||
import { analysisInputErrorFromIssues } from "../../domain/inputIssueProjection.js";
|
||||
import {
|
||||
byteEntropySchema,
|
||||
computeBlockEntropy,
|
||||
@@ -37,7 +36,10 @@ import {
|
||||
import { analysisErrorWithCleanupFailure } from "../../domain/analysisErrorCleanup.js";
|
||||
import { ArtifactReaderFailure } from "../../artifacts/ArtifactReader.js";
|
||||
import { sameRegularFileState } from "../../filesystem/RegularFile.js";
|
||||
import { completeProviderEvidence } from "../ProviderOperationExecution.js";
|
||||
import {
|
||||
completeProviderEvidence,
|
||||
parseProviderOperationInput,
|
||||
} from "../ProviderOperationExecution.js";
|
||||
|
||||
/** Bound retained result rows before constructing the Evidence representation. */
|
||||
export const MAX_BYTE_ENTROPY_BLOCKS = 32_768;
|
||||
@@ -97,18 +99,14 @@ export class ByteEntropyService {
|
||||
rawInput: unknown,
|
||||
options?: ExecutionOptions,
|
||||
): Promise<Result<Evidence, AnalysisError>> {
|
||||
if (options?.signal?.aborted)
|
||||
return err(
|
||||
new AnalysisCancelledError(OPERATION, { cause: options.signal.reason }),
|
||||
);
|
||||
const parsed = inspectByteEntropyInputSchema.safeParse(rawInput);
|
||||
if (!parsed.success)
|
||||
return err(
|
||||
analysisInputErrorFromIssues(OPERATION, parsed.error.issues, rawInput, {
|
||||
cause: parsed.error,
|
||||
}),
|
||||
);
|
||||
const input = parsed.data;
|
||||
const parsed = parseProviderOperationInput(
|
||||
OPERATION,
|
||||
rawInput,
|
||||
inspectByteEntropyInputSchema,
|
||||
options?.signal,
|
||||
);
|
||||
if (!parsed.ok) return parsed;
|
||||
const input = parsed.value;
|
||||
if (!isAbsolute(input.path))
|
||||
return err(
|
||||
invalid("path", "Expected an absolute filesystem path on this host."),
|
||||
|
||||
Reference in new issue
Block a user