fix: normalize bundled file permissions to world-readable#1012
Draft
fix: normalize bundled file permissions to world-readable#1012
Conversation
Code bundles preserved source-tree mode bits, so files stored as 0o600 (common in repos with restrictive perms) were unreadable by non-root pod users at runtime. Pod-side chmod is not always available — securityContext restrictions can block it — so the normalization has to happen at pack time. Extends tar_strip_file_attributes (which already strips uid/gid/mtime) to also normalize mode: 0o644 for files, 0o755 for directories. Executable bits are dropped; bundled assets are data, not scripts run from the bundle. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ranjit-parva
approved these changes
Apr 25, 2026
pingsutw
approved these changes
Apr 25, 2026
Contributor
Author
|
We are still waiting, to test it fully, cc @ranjit-parva |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a permission-denied failure on tasks that use
Environment.includeto bundle assets (templates, configs, etc.) when the source files have restrictive perms.A user reported that their git-tracked files are stored with
0o600perms; when bundled and extracted in the pod, the non-root runtime user could not read them. They asked: can wechmod a+rbefore packing? Pod-sidechmodis not always available — securityContext can block it — so the fix has to happen at pack time.The bundler already had a
tar_strip_file_attributesfilter that normalizeduid/gid/mtime/pax_headersso the archive doesn't leak host-machine metadata. It deliberately leftmodealone, which was the bug: source-tree mode bits aren't portable runtime perms. Extended the same filter to also normalizemode:0o6440o755The executable bit is intentionally dropped — bundled assets are data, not scripts run directly from the bundle. If we ever hit a real case for executable bundled files, we can selectively preserve
+x. No flag for opt-out: every other bundle-attribute strip is unconditional, and preserving 0o600 is the actual bug, not a feature.Changes
src/flyte/_code_bundle/_utils.py— extendtar_strip_file_attributesto setmodeto0o644(files) /0o755(dirs).src/flyte/_environment.py— note the normalization on theincludedocstring.tests/flyte/code_bundle/test_code_bundle.py— 4 new tests:create_bundle(the path used byEnvironment.include)Test plan
uv run pytest tests/flyte/code_bundle/— 60 passedchmod 600, confirm it's readable as a non-root pod user after extraction🤖 Generated with Claude Code