Reject GCS blob names that escape the target directory on download (#67509)
``GCSHook.sync_to_local_dir`` and ``GCSTimeSpanFileTransformOperator._download`` joined GCS blob names into local paths without verifying the resolved path stayed within the intended directory. GCS allows object names containing ``..`` segments, so a hostile blob name could cause files to be written outside ``local_dir`` / the operator's temp dir — a classic CWE-22 path-traversal sink. The trust model matters: a DAG author's own bucket is trusted, but operators are routinely pointed at buckets shared with external partners or other tenants, where the write side may not be fully trusted. Resolve the destination and assert ``is_relative_to`` the target root before any download. On violation, raise ``ValueError`` with a clear message instead of silently writing outside the target.
J
Jarek Potiuk committed
8da850235a2b2e870ca391233dfc86f03ea4c367
Parent: 25a4738
Committed by GitHub <noreply@github.com>
on 5/29/2026, 1:25:09 PM