Make log payloads opaque pass-through
This commit is contained in:
@@ -31,8 +31,6 @@ const forbiddenProjectionKeys = new Set([
|
||||
"bindings",
|
||||
"downloadref"
|
||||
]);
|
||||
const unsafeProjectionText = /(?:\/Users\/|\/home\/|\/var\/run\/|[A-Za-z]:\\|unix:\/\/|tcp:\/\/|Bearer\s+|password=|token=|sk-[A-Za-z0-9_-]+)/i;
|
||||
|
||||
export function parseSafeDependencyCatalog(value: unknown): DependencyCatalogResponse {
|
||||
const record = requiredRecordValue(value, "dependency catalog");
|
||||
rejectForbiddenProjection(record);
|
||||
@@ -72,9 +70,9 @@ function parseDependencyProbe(value: unknown): DependencyProbeViewResponse {
|
||||
key: requiredString(record, "key"),
|
||||
kind: requiredString(record, "kind"),
|
||||
required: requiredBoolean(record, "required"),
|
||||
minimumVersion: optionalSafeString(record, "minimumVersion"),
|
||||
minimumVersion: optionalString(record, "minimumVersion"),
|
||||
state,
|
||||
evidence: optionalSafeString(record, "evidence"),
|
||||
evidence: optionalString(record, "evidence"),
|
||||
installPlanKey: optionalString(record, "installPlanKey")
|
||||
};
|
||||
}
|
||||
@@ -125,7 +123,7 @@ function parseRunUpdate(record: Record<string, unknown>): RunUpdateJobResponse {
|
||||
idempotencyKey: optionalString(record, "idempotencyKey"),
|
||||
status,
|
||||
phase,
|
||||
message: optionalSafeString(record, "message"),
|
||||
message: optionalString(record, "message"),
|
||||
rollback: requiredBoolean(record, "rollback"),
|
||||
createdAt: requiredString(record, "createdAt"),
|
||||
updatedAt: requiredString(record, "updatedAt")
|
||||
@@ -168,12 +166,6 @@ function optionalString(value: Record<string, unknown>, key: string): string | u
|
||||
return field;
|
||||
}
|
||||
|
||||
function optionalSafeString(value: Record<string, unknown>, key: string): string | undefined {
|
||||
const field = optionalString(value, key);
|
||||
if (field && unsafeProjectionText.test(field)) throw new Error(`${key} contains unsafe runtime details`);
|
||||
return field;
|
||||
}
|
||||
|
||||
function requiredChecksum(value: Record<string, unknown>, key: string): string {
|
||||
const field = requiredString(value, key);
|
||||
if (!/^sha256:[a-f0-9]{64}$/.test(field)) throw new Error(`${key} must be a SHA-256 checksum`);
|
||||
|
||||
Reference in New Issue
Block a user