cultcache-ts inspector: recoverCatalogEntry reads through the same bounded door as previewPayload
Finding inspector-recover-unwalked: one decodeBoundedPayload (walk, then decode) serves both the stamp recovery and the preview, so a payload past the limit is never decoded by either. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9df32ec64f
commit
ef682ad7b0
1 changed files with 7 additions and 1 deletions
|
|
@ -219,7 +219,7 @@ function decodeV1Record(value: unknown, catalogBySchemaId: Map<string, Inspected
|
|||
function recoverCatalogEntry(schemaId: string, payload: Uint8Array): InspectedCatalogEntry | undefined {
|
||||
let payloadPreview: unknown;
|
||||
try {
|
||||
payloadPreview = decode(payload);
|
||||
payloadPreview = decodeBoundedPayload(payload);
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
|
|
@ -287,6 +287,12 @@ function decodeLegacyEnvelope(value: unknown): InspectedRecord {
|
|||
};
|
||||
}
|
||||
|
||||
// The inspector's one payload read: the depth walk first, so a payload past the limit is refused before any decoder sees it.
|
||||
function decodeBoundedPayload(payload: Uint8Array): unknown {
|
||||
checkPayloadDepth(payload);
|
||||
return decode(payload);
|
||||
}
|
||||
|
||||
function previewPayload(payload: Uint8Array): Pick<InspectedRecord, "payloadPreview" | "payloadDecodeError"> {
|
||||
try {
|
||||
checkPayloadDepth(payload);
|
||||
|
|
|
|||
Loading…
Reference in a new issue