fix(artifacts): authenticate file subjects across provider and view boundaries
Narrow WASM and EVM execution ports to file subjects and preserve supplied subject types at the shared execution factory. Authenticate format with path and digest before recording or projecting Evidence, using the existing WASM identity owner in both consumers. Validation: focused WASM/EVM service and public MCP workflows passed, including malformed provider subjects and self-contained retained Evidence with contradictory format. Global typecheck/lint and documentation checks passed. Real WABT/Evmole execution and the full suite were not run.
This commit is contained in:
@@ -54,6 +54,15 @@ export interface AnalysisExecution {
|
||||
readonly subject: EvidenceSubjectTarget | null;
|
||||
}
|
||||
|
||||
interface CreateAnalysisExecutionOptions {
|
||||
readonly rawResult?: unknown;
|
||||
readonly analysisProfile?: AnalysisProfileCommitment;
|
||||
readonly limitations?: readonly string[];
|
||||
readonly relationshipCoverage?: RelationshipCoverage;
|
||||
readonly locations?: readonly EvidenceLocation[];
|
||||
readonly subject?: EvidenceSubjectTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a validated atomic provider observation at an adapter boundary.
|
||||
*
|
||||
@@ -61,38 +70,43 @@ export interface AnalysisExecution {
|
||||
* `result`. Omitting it records `null` rather than a second complete copy of
|
||||
* the normalized result in every Evidence record and tool response.
|
||||
*/
|
||||
export const createAnalysisExecution = (
|
||||
export function createAnalysisExecution<Subject extends EvidenceSubjectTarget>(
|
||||
result: unknown,
|
||||
provider: ProviderIdentity,
|
||||
options: {
|
||||
readonly rawResult?: unknown;
|
||||
readonly analysisProfile?: AnalysisProfileCommitment;
|
||||
readonly limitations?: readonly string[];
|
||||
readonly relationshipCoverage?: RelationshipCoverage;
|
||||
readonly locations?: readonly EvidenceLocation[];
|
||||
readonly subject?: EvidenceSubjectTarget;
|
||||
} = {},
|
||||
): AnalysisExecution => ({
|
||||
result: jsonValueSchema.parse(result),
|
||||
rawResult:
|
||||
options.rawResult === undefined
|
||||
? null
|
||||
: jsonValueSchema.parse(options.rawResult),
|
||||
provider,
|
||||
...(options.analysisProfile === undefined
|
||||
? {}
|
||||
: { analysisProfile: structuredClone(options.analysisProfile) }),
|
||||
limitations: [...(options.limitations ?? [])],
|
||||
...(options.relationshipCoverage === undefined
|
||||
? {}
|
||||
: {
|
||||
relationshipCoverage: relationshipCoverageSchema.parse(
|
||||
options.relationshipCoverage,
|
||||
),
|
||||
}),
|
||||
locations: [...(options.locations ?? [])],
|
||||
subject: options.subject ?? null,
|
||||
});
|
||||
options: CreateAnalysisExecutionOptions & { readonly subject: Subject },
|
||||
): Omit<AnalysisExecution, "subject"> & { readonly subject: Subject };
|
||||
export function createAnalysisExecution(
|
||||
result: unknown,
|
||||
provider: ProviderIdentity,
|
||||
options?: CreateAnalysisExecutionOptions,
|
||||
): AnalysisExecution;
|
||||
export function createAnalysisExecution(
|
||||
result: unknown,
|
||||
provider: ProviderIdentity,
|
||||
options: CreateAnalysisExecutionOptions = {},
|
||||
): AnalysisExecution {
|
||||
return {
|
||||
result: jsonValueSchema.parse(result),
|
||||
rawResult:
|
||||
options.rawResult === undefined
|
||||
? null
|
||||
: jsonValueSchema.parse(options.rawResult),
|
||||
provider,
|
||||
...(options.analysisProfile === undefined
|
||||
? {}
|
||||
: { analysisProfile: structuredClone(options.analysisProfile) }),
|
||||
limitations: [...(options.limitations ?? [])],
|
||||
...(options.relationshipCoverage === undefined
|
||||
? {}
|
||||
: {
|
||||
relationshipCoverage: relationshipCoverageSchema.parse(
|
||||
options.relationshipCoverage,
|
||||
),
|
||||
}),
|
||||
locations: [...(options.locations ?? [])],
|
||||
subject: options.subject ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
/** Provider-neutral application capability for one analysis operation. */
|
||||
export interface AnalysisOperationPort {
|
||||
|
||||
Reference in New Issue
Block a user