<#1063 fix: skip symlinks pointing outside source ...
# flyte-github
a
#1063 fix: skip symlinks pointing outside source when bundling code Pull request opened by EngHabu Summary •
create_bundle
and
ls_relative_files
computed the arcname / hash path via
Path(ws_file).resolve().relative_to(source.resolve())
.
resolve()
follows symlinks, so a symlink inside the source dir that points outside the source dir (e.g.
.venv/bin/python
->
/usr/bin/python3.10
) crashes with
ValueError: '/usr/bin/python3.10' is not in the subpath of '<source>'
, aborting the entire deploy at code-bundle time. • Switch both call sites to
os.path.relpath
against the absolute (non-resolved) source path.
abspath
still normalizes ".." components (the property the original
resolve()
was added to preserve, per the comment) but doesn't follow symlinks, so the arcname reflects the file's position inside
source
rather than the symlink target's location. • As a defensive fallback,
create_bundle
now skips and logs a warning for any path that still lands outside
source
after normalization, rather than letting one stray entry abort the whole bundle. Sentry issues Fixes FLYTE-SDK-2E Test plan • New regression test
test_create_bundle_skips_symlinks_pointing_outside_source
constructs the exact symlink-outside-source shape from the Sentry crash and asserts the bundle succeeds • Existing
test_create_bundle_*
and
test_ls_relative_files_*
tests still pass flyteorg/flyte-sdk