Skip to content

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

Description

@torstenfohrer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions