mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
* fix(ci): retire unused internal analysis declarations * test: use an admitted app bundle for provider routing (cherry picked from commit00aa17f12a) * test: keep bundle routing coverage outside oversized group (cherry picked from commit8658353b0d) * fix(ci): align regression fixtures with current admission contracts * test: bind extraction close fixtures to their ZIP digest (cherry picked from commit626d0250db) * test(cli): match typed analysis outcomes in function detail fixture * test(ghidra): preserve empty Java property separator framing * test(electron): retain unknown IPC ownership for native module gaps * fix(electron): share source-scoped call path identity * test(captures): assert safe source identity on SAZ refusal * test(apple): match root occurrence kind to inventory manifest * fix(examples): align directory root occurrence identity * test(electron): align equivalent fixture assertions with upstream * test(process): assert retained capture root identity * test(windows): declare the PE fixture optional header * test(ci): refresh owned registration and verifier fixtures * test(setup): use owned registrations for refresh fixtures * test(process): control unavailable ownership in CLI cleanup fixture * test(process): guard controlled compiler output arguments * test(setup): align equivalent entrypoint guards with upstream * test(process): release the cleanup target through an owned gate * test(ci): align semantic identities and owned fixture facts * test(pcap): retain the upstream DNS wire fixture branch * test(pcap): use the canonical wire ownership fixture * test(pcap): assert exact DNS wire query labels * test(ci): preserve admission and ownership fixture prerequisites * test(ci): align authenticated fixture and cleanup boundaries * test(windows): align native artifact fixtures with upstream * test(android): request complete evidence for inline MCP contracts * test: avoid pinning diagnostic wording * test: verify cleanup diagnostics at their source * test: strengthen evidence and cleanup checks * test: avoid pinning registration guidance --------- Co-authored-by: Plastic-time <Plastic-time@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
156 lines
4.0 KiB
TypeScript
156 lines
4.0 KiB
TypeScript
import { createEvidence } from "../domain/evidence.js";
|
|
import {
|
|
artifactInventoryResultSchema,
|
|
type ArtifactNode,
|
|
type ArtifactOccurrence,
|
|
} from "../domain/artifactGraph.js";
|
|
import {
|
|
artifactGraphDigest,
|
|
artifactIdForContent,
|
|
artifactManifestId,
|
|
occurrenceIdForLocation,
|
|
} from "../domain/artifactIdentity.js";
|
|
|
|
const inventory = (
|
|
format: "apk" | "ipa" | "directory" | "hap",
|
|
digit: string,
|
|
) => {
|
|
const sha = digit.repeat(64);
|
|
const artifactId = artifactIdForContent(sha);
|
|
const rootEntryKind = format === "directory" ? "directory" : "file";
|
|
const occurrenceId = occurrenceIdForLocation({
|
|
rootArtifactId: artifactId,
|
|
logicalPath: ".",
|
|
entryKind: rootEntryKind,
|
|
});
|
|
const nodes: ArtifactNode[] = [
|
|
{
|
|
artifact_id: artifactId,
|
|
format: format === "directory" ? "directory" : "zip",
|
|
sha256: sha,
|
|
size: 1,
|
|
media_type: null,
|
|
architecture: null,
|
|
content_state: "materialized",
|
|
limitations: [],
|
|
},
|
|
];
|
|
const occurrences: ArtifactOccurrence[] = [
|
|
{
|
|
occurrence_id: occurrenceId,
|
|
artifact_id: artifactId,
|
|
parent_occurrence_id: null,
|
|
logical_path: ".",
|
|
entry_kind: rootEntryKind,
|
|
artifact_kind: "resource",
|
|
artifact_format: format,
|
|
declared_size: 1,
|
|
compressed_size: null,
|
|
executable: false,
|
|
encrypted: false,
|
|
hash_status: "verified",
|
|
source_location: null,
|
|
limitations: [],
|
|
},
|
|
];
|
|
const graphSha256 = artifactGraphDigest({
|
|
nodes,
|
|
occurrences,
|
|
edges: [],
|
|
contradictions: [],
|
|
});
|
|
return artifactInventoryResultSchema.parse({
|
|
manifest: {
|
|
manifest_id: artifactManifestId(artifactId, graphSha256),
|
|
root_artifact_id: artifactId,
|
|
root_sha256: sha,
|
|
root_format: format,
|
|
graph_sha256: graphSha256,
|
|
node_count: nodes.length,
|
|
occurrence_count: occurrences.length,
|
|
edge_count: 0,
|
|
},
|
|
nodes,
|
|
occurrences,
|
|
edges: [],
|
|
provenance: [],
|
|
integrity_contradictions: [],
|
|
coverage: { scope: "root", status: "complete" },
|
|
limitations: [],
|
|
});
|
|
};
|
|
|
|
const provider = {
|
|
id: "rea-artifact-graph",
|
|
name: "REA safe artifact graph provider",
|
|
version: "1",
|
|
} as const;
|
|
|
|
/** Catalog example for Android application inventory projection. */
|
|
export const ANDROID_APPLICATION_GRAPH_EXAMPLE = {
|
|
inventory_evidence: [
|
|
createEvidence(
|
|
{ path: "Fixture.apk", sha256: "a".repeat(64), format: "apk" },
|
|
provider,
|
|
{
|
|
operation: "inventory_artifact",
|
|
parameters: {},
|
|
result: inventory("apk", "a"),
|
|
confidence: "observed",
|
|
authority: "shipped-artifact",
|
|
},
|
|
),
|
|
],
|
|
};
|
|
|
|
/** Catalog example for Apple application inventory projection. */
|
|
export const APPLE_APPLICATION_GRAPH_EXAMPLE = {
|
|
inventory_evidence: [
|
|
createEvidence(
|
|
{ path: "Fixture.ipa", sha256: "b".repeat(64), format: "ipa" },
|
|
provider,
|
|
{
|
|
operation: "inventory_artifact",
|
|
parameters: {},
|
|
result: inventory("ipa", "b"),
|
|
confidence: "observed",
|
|
authority: "shipped-artifact",
|
|
},
|
|
),
|
|
],
|
|
};
|
|
|
|
/** Catalog example for a macOS application bundle inventoried as a directory. */
|
|
export const MACOS_APPLICATION_GRAPH_EXAMPLE = {
|
|
inventory_evidence: [
|
|
createEvidence(
|
|
{ path: "Fixture.app", sha256: "c".repeat(64), format: "directory" },
|
|
provider,
|
|
{
|
|
operation: "inventory_artifact",
|
|
parameters: {},
|
|
result: inventory("directory", "c"),
|
|
confidence: "observed",
|
|
authority: "shipped-artifact",
|
|
},
|
|
),
|
|
],
|
|
};
|
|
|
|
/** Catalog example for HarmonyOS application inventory projection. */
|
|
export const HARMONY_APPLICATION_GRAPH_EXAMPLE = {
|
|
inventory_evidence: [
|
|
createEvidence(
|
|
{ path: "Fixture.hap", sha256: "d".repeat(64), format: "hap" },
|
|
provider,
|
|
{
|
|
operation: "inventory_artifact",
|
|
parameters: {},
|
|
result: inventory("hap", "d"),
|
|
confidence: "observed",
|
|
authority: "shipped-artifact",
|
|
},
|
|
),
|
|
],
|
|
};
|