Skip to content

[Bug]: Pipeline.loads/from_dict raise AttributeError instead of DeserializationError for non-mapping documents #13738

Open

Description

@zhengqiuyang

Description

Pipeline.loads() documents :raises DeserializationError:, but a YAML document that is not a mapping reaches Pipeline.from_dict(), which reads its keys straight off the input (data.get(...)). Callers get a raw AttributeError with a traceback inside Haystack instead of the documented error.

This shows up with ordinary inputs, not just hostile ones: an empty or comment-only pipeline file unmarshals to None.

from haystack import Pipeline

Pipeline.loads("")     # AttributeError: 'NoneType' object has no attribute 'get'
Pipeline.loads("[]")   # AttributeError: 'list' object has no attribute 'get'
Pipeline.loads("42")   # AttributeError: 'int' object has no attribute 'get'
Pipeline.from_dict(None)

Expected behavior

DeserializationError, as documented on Pipeline.loads() and handled by callers that already catch it.

Additional context

test/fuzz/fuzz_pipeline_loads.py already records this as a known finding: it carries _KNOWN_BUGS = (AttributeError,) and tolerates that exception for the whole target, so any other AttributeError raised from loads() is hidden too. The comment there says the tolerance should be removed once from_dict validates its input type.

Not a security report: per SECURITY.md, loading untrusted pipeline definitions is out of scope by design. This is about the documented error contract and the fuzz target's blind spot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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