taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit c554817fe1591e9c05f67423c0e300c87f537ea4
parent 376df4b315b2b3657838458c1d6d3dd12935acaf
Author: Florian Dold <florian@dold.me>
Date:   Sat, 18 Jul 2026 11:14:37 +0200

util: stricter validation in object codecs

Diffstat:
Mpackages/taler-util/src/codec.ts | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/taler-util/src/codec.ts b/packages/taler-util/src/codec.ts @@ -184,7 +184,7 @@ class ObjectCodecBuilder<OutputType, PartialOutputType> { path: [`(${objectDisplayName})`], }; } - if (typeof x !== "object") { + if (typeof x !== "object" || x === null || Array.isArray(x)) { throw new DecodingError( `expected object for ${objectDisplayName} at ${renderContext( c, @@ -360,7 +360,7 @@ export function codecForMap<T>( return { decode(x: any, c?: Context): { [x: string]: T } { const map: { [x: string]: T } = {}; - if (typeof x !== "object") { + if (typeof x !== "object" || x === null) { throw new DecodingError(`expected object at ${renderContext(c)}`); } for (const i in x) {