You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YAML supports the !!binary syntax for declaring binary values, which is supported by js-yaml and is parsed as Uint8Array values, but config mangles them by turning them into objects.
Expected secret: Uint8Array(6) [ 0, 1, 2, 3, 4, 5 ]
Actual secret: Uint8Array { '0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5 }
node:buffer:535
if (obj.length !== undefined || isAnyArrayBuffer(obj.buffer)) {
^
TypeError: Method get TypedArray.prototype.length called on incompatible receiver [object Object]
at get length (<anonymous>)
at fromObject (node:buffer:535:11)
at Function.from (node:buffer:312:15)
at file:///[dir]/config-yaml-binary-bug/src/index.js:10:29
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Please tell us about your environment:
node-config version: 3.3.11
node-version: 20.11.00
js-yaml version: 4.1.0
Edit: One way to fix this without breaking immutability would be to convert typed arrays to regular arrays with Array.from(), then freeze them. But since Buffer instances are already returned unmodified, perhaps the simplest fix would be to add
The text was updated successfully, but these errors were encountered:
YAML supports the
!!binary
syntax for declaring binary values, which is supported byjs-yaml
and is parsed asUint8Array
values, butconfig
mangles them by turning them into objects.For a minimal example, see:
https://codeberg.org/Linneris/config-yaml-binary-bug
Run:
Expected output
Actual output
Please tell us about your environment:
Edit: One way to fix this without breaking immutability would be to convert typed arrays to regular arrays with
Array.from()
, then freeze them. But sinceBuffer
instances are already returned unmodified, perhaps the simplest fix would be to addThe text was updated successfully, but these errors were encountered: