Skip to content

otellogr: Recursive log conversion can crash on cyclic data #9044

Description

@pellared

Description

bridges/otellogr recursively converts logged map, slice, array, pointer, and interface values without cycle detection or a maximum depth. Current-tree validation showed Info, Error, and WithValues route key/value pairs through convertKVs, which calls convertValue recursively.

Steps To Reproduce

05-64319f7dcd008191b710dfa7316b5c8b-recursive-log-conversion-can-crash-on-cyclic-data.zip

  1. Use go.opentelemetry.io/contrib/bridges/otellogr.
  2. Create a cyclic value such as m := map[string]any{}; m["self"] = m.
  3. Log the value through otellogr.LogSink.Info, Error, or WithValues, or run the PoC test from the artifact zip.
  4. Observe unbounded recursion that can lead to stack exhaustion or process crash.

Expected behavior

Recursive log value conversion should detect cycles or enforce a maximum depth so cyclic or extremely deep values cannot crash the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bridge: logrRelated to the logr bridgebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions