Diesel: Command injection in Diesel's implementation of `COPY FROM`/`COPY TO`
Moderate severity
GitHub Reviewed
Published
May 19, 2026
to the GitHub Advisory Database
•
Updated May 19, 2026
Description
Published to the GitHub Advisory Database
May 19, 2026
Reviewed
May 19, 2026
Last updated
May 19, 2026
Diesel allows users to configure various options for PostgreSQL's
COPY FROMandCOPY TOstatements. These configurations are partially provided as strings or characters.Diesel did not check if any these user-provided options contain a quote character
', which can lead to the injection of additional options in the currentCOPY FROM/COPY TOstatement.This vulnerability affects any user of
COPY FROM/COPY TOthat passes user-provided input to any of the affected functions. It can result in modifications of options in the current statement, but it is not possible inject additional statements.Mitigation
The preferred mitigation to the outlined problem is to update to Diesel version 2.3.8 or newer, which includes fixes for the problem.
Resolution
Diesel now correctly escapes any quotes contained in the provided arguments.
References