Skip to content

fix: escape metadata values in DirectoryMetadata.__createMetaSelection#8708

Merged
chrisburr merged 1 commit into
DIRACGrid:integrationfrom
chrisburr:fix/directory-metadata-sql-injection
Jul 13, 2026
Merged

fix: escape metadata values in DirectoryMetadata.__createMetaSelection#8708
chrisburr merged 1 commit into
DIRACGrid:integrationfrom
chrisburr:fix/directory-metadata-sql-injection

Conversation

@chrisburr

Copy link
Copy Markdown
Member

BEGINRELEASENOTES

*DataManagementSystem
FIX: escape user-supplied metadata values in DirectoryMetadata

ENDRELEASENOTES

__createMetaSelection interpolated user-supplied metadata operands
directly into the SQL selection string (e.g. "{table}Value='{operand}'"),
and the callers (__findSubdirByMeta, __checkDirsForMetadata) execute the
resulting query with no bound args, so a crafted metadata query value was
live SQL -> injection via findDirectoriesByMetadata.

Escape every string operand through the DB _escapeString/_escapeValues
helpers (which quote and escape the value) before inlining it, mirroring
the FileMetadata.__createMetaSelection sibling which already does this.
Numeric operands keep their existing safe %d/%f handling.

This defect predates the SQL-parameterisation series.
@fstagni
fstagni requested a review from sfayer July 13, 2026 10:01
@chrisburr
chrisburr merged commit fd832c7 into DIRACGrid:integration Jul 13, 2026
26 of 27 checks passed
@DIRACGridBot DIRACGridBot added the sweep:ignore Prevent sweeping from being ran for this PR label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweep:ignore Prevent sweeping from being ran for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants