fix(evidence): reject unsupported metadata before authentication
Close persisted Evidence, bundle, profile and unknown record shapes so parsing cannot silently remove caller metadata before checking semantic identity. Keep constructor provider projection explicit and JSON payload fields open. Exercise actual MCP export/import with independent record and manifest mutations, unchanged state after rejection, and a valid round trip. Prune duplicate source assertions. Validation: focused domain/CLI/MCP/filesystem checks, converted JSON Schemas, docs and typecheck/lint.
This commit is contained in:
@@ -7,13 +7,13 @@ import { jsonObjectSchema, type JsonValue } from "./jsonValue.js";
|
||||
import { digestSchema } from "./../domain/digests.js";
|
||||
|
||||
/** Concrete provider identity committed by an analysis profile. */
|
||||
export const committedProviderSchema = z.object({
|
||||
export const committedProviderSchema = z.strictObject({
|
||||
id: z.string().min(1),
|
||||
name: z.string().min(1),
|
||||
version: z.string().min(1),
|
||||
});
|
||||
|
||||
const unsignedAnalysisProfileSchema = z.object({
|
||||
const unsignedAnalysisProfileSchema = z.strictObject({
|
||||
provider: committedProviderSchema,
|
||||
parameters: jsonObjectSchema,
|
||||
});
|
||||
@@ -40,7 +40,11 @@ export const createAnalysisProfile = (
|
||||
parameters: Readonly<Record<string, JsonValue>>,
|
||||
): AnalysisProfileCommitment => {
|
||||
const unsigned = unsignedAnalysisProfileSchema.parse({
|
||||
provider,
|
||||
provider: {
|
||||
id: provider.id,
|
||||
name: provider.name,
|
||||
version: provider.version,
|
||||
},
|
||||
parameters,
|
||||
});
|
||||
return analysisProfileSchema.parse({
|
||||
|
||||
Reference in New Issue
Block a user