fix: Allow dockerfile_template access during bentoml containerize#5572
Open
BillionClaw wants to merge 2 commits intobentoml:mainfrom
Open
fix: Allow dockerfile_template access during bentoml containerize#5572BillionClaw wants to merge 2 commits intobentoml:mainfrom
BillionClaw wants to merge 2 commits intobentoml:mainfrom
Conversation
… containerize PR bentoml#5548 introduced a security fix that added secure=True as the default for resolve_user_filepath(). This inadvertently broke bentoml containerize when using dockerfile_template or setup_script paths outside the current working directory. This fix adds secure=False to the resolve_user_filepath() calls for: - dockerfile_template in build_config.py and generate.py - setup_script in build_config.py These paths are provided by the user in their bento configuration and should be allowed to reference files outside the build context. Fixes bentoml#5566
For more information, see https://pre-commit.ci
Collaborator
|
But this beats the purpose of original effort to avoid including arbitrary files by accident. Doesn't changing directory to folder containing setup script and docker template work? |
|
Friendly bump -- this PR has been open for a while. Happy to make any changes if needed, or close it if no longer relevant. |
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.
What does this PR address?
Fixes #5566
PR #5548 introduced a security fix that added
secure=Trueas the default forresolve_user_filepath(). This inadvertently brokebentoml containerizewhen usingdockerfile_templateorsetup_scriptpaths outside the current working directory.Root Cause
After the security fix in PR #5548, the
resolve_user_filepath()function defaults tosecure=True, which:The
dockerfile_templateandsetup_scriptoptions in the bento configuration are user-provided paths that should legitimately be allowed to reference files outside the immediate build context (e.g., shared templates in a parent directory).Changes
This fix adds
secure=Falseto theresolve_user_filepath()calls for:dockerfile_templateinbuild_config.pyandgenerate.pysetup_scriptinbuild_config.pyTesting
tests/unit/_internal/bento/test_bento.py- all passBefore submitting:
I have read the CLA Document and I hereby sign the CLA.