dspy is vulnerable to Arbitrary File Read
86
High Risk
The dspy chat and JSON adapters parse untrusted language model completions into dspy.Image and dspy.Audio typed output fields during validation. When a completion supplies a filesystem path in the url field, the type constructor reaches the os.path.isfile branch in image.py and audio.py, reads that local file, and base64-encodes it. The encoded contents are then embedded into the next outgoing prompt sent to the model endpoint, so any entity that can influence model output can read and exfiltrate arbitrary local files. The fix makes resource construction and validation free of implicit filesystem and network access and requires explicit factory methods to load local or remote resources.
You are affected if you are using a version that falls within the vulnerable range and you use signatures with dspy.Image or dspy.Audio output fields whose values are parsed from untrusted language model output.
dspy is vulnerable to Arbitrary File Read in versions 0.0.1 - 3.2.1.
Upgrade the dspy library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant