mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
fix(managed): derive native platform facts before symbol matching (#10090)
fix(managed): derive native verification platform at intake
This commit is contained in:
1 parent
98f796c991
commit
34025d2fcd
5 files changed
+297
-66
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { isMachOFormat } from "../binaryTargetTypes.js";
|
||||
import { getEvidenceInputContract } from "../evidenceInputContract.js";
|
||||
import { managedNativeVerificationRequestSchema } from "./managedNativeVerificationSchemas.js";
|
||||
|
||||
@@ -30,10 +31,14 @@ export interface ManagedNativeVerificationSource {
|
||||
readonly nativeObservations: readonly ManagedNativeObservationFacts[];
|
||||
}
|
||||
|
||||
/** Module lookup semantics proved by the native subject's format. */
|
||||
export type ManagedNativePlatform = "pe" | "elf" | "mach-o" | null;
|
||||
|
||||
export interface ManagedNativeObservationFacts {
|
||||
readonly evidence: Evidence;
|
||||
readonly symbols: readonly NativeSymbol[];
|
||||
readonly supported: boolean;
|
||||
readonly platform: ManagedNativePlatform;
|
||||
/** Coverage of an export inventory; function observations are targeted. */
|
||||
readonly exportCoverage?: {
|
||||
readonly exhaustive: boolean;
|
||||
@@ -58,6 +63,12 @@ const readNativeObservation = (
|
||||
const read = readEvidence(raw);
|
||||
if (!read.ok) return read;
|
||||
const evidence = read.value;
|
||||
const format = evidence.subject?.format;
|
||||
const platform: ManagedNativePlatform = isMachOFormat(format)
|
||||
? "mach-o"
|
||||
: format === "pe" || format === "elf"
|
||||
? format
|
||||
: null;
|
||||
if (evidence.operation === "inspect_macho") {
|
||||
const payload = readEvidencePayload(
|
||||
retainedInspectMachoSchema,
|
||||
@@ -66,6 +77,7 @@ const readNativeObservation = (
|
||||
if (!payload.ok) return payload;
|
||||
return ok({
|
||||
evidence,
|
||||
platform,
|
||||
supported: true,
|
||||
exportCoverage: {
|
||||
exhaustive: payload.value.exports.exhaustive,
|
||||
@@ -90,6 +102,7 @@ const readNativeObservation = (
|
||||
if (!payload.ok) return payload;
|
||||
return ok({
|
||||
evidence,
|
||||
platform,
|
||||
supported: true,
|
||||
symbols: [
|
||||
{
|
||||
@@ -104,7 +117,12 @@ const readNativeObservation = (
|
||||
],
|
||||
});
|
||||
}
|
||||
return ok({ evidence, supported: false, symbols: [] });
|
||||
return ok({
|
||||
evidence,
|
||||
platform,
|
||||
supported: false,
|
||||
symbols: [],
|
||||
});
|
||||
};
|
||||
|
||||
/** Authenticate and parse source Evidence once, retaining it for session recording. */
|
||||
|
||||
Reference in new issue
Block a user