mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 17:44:27 +00:00
fix(evidence): preserve subjects in derived workflows (#9492)
* fix(javascript): preserve verified trace evidence subjects Co-authored-by: Felix <3937061056@qq.com> * fix(evidence): preserve selected subject names in views * fix(evidence): preserve subjects across related workflows * fix(evidence): retain inventory projection subjects * fix(managed): validate projected graph root identity * style: format evidence and native command code * fix(javascript): validate static graph root identity * test(javascript): update feature trace graph expectations --------- Co-authored-by: Felix <3937061056@qq.com>
This commit is contained in:
1 parent
4d7c6efe9a
commit
52fe342c73
28 files changed
+615
-151
No files matched your search
@@ -3,7 +3,12 @@ import {
|
||||
JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER,
|
||||
MANAGED_WORKFLOW_PROVIDER,
|
||||
} from "../../domain/investigationProviders.js";
|
||||
import { isImmutableEvidence, type Evidence } from "../../domain/evidence.js";
|
||||
import {
|
||||
isImmutableEvidence,
|
||||
evidenceSubjectTarget,
|
||||
type Evidence,
|
||||
type EvidenceSubjectTarget,
|
||||
} from "../../domain/evidence.js";
|
||||
import { readEvidence } from "../../domain/evidenceValidation.js";
|
||||
import { EvidenceIntegrityError } from "../../domain/evidenceErrors.js";
|
||||
import {
|
||||
@@ -35,6 +40,32 @@ export interface ApplicationGraphEvidenceSource {
|
||||
readonly semanticGraph: JavaScriptSemanticGraph | null;
|
||||
}
|
||||
|
||||
/** Carry a subject only when it identifies the graph's root artifact. */
|
||||
export const applicationGraphSubjectTarget = (
|
||||
source: ApplicationGraphEvidenceSource,
|
||||
): EvidenceSubjectTarget | undefined => {
|
||||
const subject = source.evidence.subject;
|
||||
const staticRootObserved =
|
||||
source.kind === "static-application" &&
|
||||
source.graph.nodes.some(
|
||||
(node) =>
|
||||
node.kind === "artifact" &&
|
||||
node.identity.strategy === "content-digest" &&
|
||||
node.identity.sha256 === source.rootArtifactSha256 &&
|
||||
node.observations.some(
|
||||
({ evidence }) => evidence.extractor.operation === "inventory-root",
|
||||
),
|
||||
);
|
||||
return evidenceSubjectTarget(
|
||||
staticRootObserved ||
|
||||
(source.kind === "managed-application" &&
|
||||
subject?.format === "pe" &&
|
||||
subject.digest.sha256 === source.rootArtifactSha256)
|
||||
? subject
|
||||
: null,
|
||||
);
|
||||
};
|
||||
|
||||
/** Caller-owned Evidence failed validation at the application graph boundary. */
|
||||
export interface ApplicationGraphEvidenceInputFailure {
|
||||
readonly issues: readonly AnalysisInputIssue[];
|
||||
|
||||
Reference in new issue
Block a user