psych icon indicating copy to clipboard operation
psych copied to clipboard

Psych.safe_load internal convert matching scaler Strings that looks like timestamps to class Time which isn't allowed as deserialization class

Open torstenfohrer opened this issue 9 months ago • 0 comments

At writing a simple example i realize that "dump/serialization" suffers from same problem.

Ruby/Psych: Latest ruby 3.3.x

y.yaml:

---
time: 2025-04-02 13:43:04.841676 +02:00

Ruby Code that tries to load file above

require 'yaml'
a = YAML.load(File.read('/y.yaml'))

Results in a Tried to load unspecified class: Time (Psych::DisallowedClass).

I expect following that psych handles this either by bypassing or allowing it (DisallowdClass). Or handles timestamp like strings AS string.

torstenfohrer avatar Apr 02 '25 12:04 torstenfohrer