Repository navigation
feat(crs-compose): add bounds for staged input artifacts - #507
Open
imshubham22apr-gif wants to merge 1 commit into
Open
imshubham22apr-gif wants to merge 1 commit into
imshubham22apr-gif wants to merge 1 commit into
Conversation
Signed-off-by: imshubham22apr-gif <imshubham.22apr@gmail.com>
This branch has not been deployed
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
Adds optional bounds validation for staged input files and input directories passed via artifact input flags (
--pov/--pov-dir,--seed-dir,--bug-candidate/--bug-candidate-dir,--report/--report-dir,--patch/--patch-dir). Limits can be set via environment variablesOSS_CRS_MAX_INPUT_FILE_SIZEandOSS_CRS_MAX_INPUT_FILE_COUNTor through code invocation parameters.Problem
When staging host artifact inputs into the exchange directory for a run,
_copy_artifact_inputcopies files or entire directory trees without pre-checking file sizes or file counts. If oversized files or runaway directories (e.g. nested symlink loops or accidentally staging an entire disk/repo tree) are supplied as inputs, the staging step can exhaust host disk space, degrade performance, or crash runner containers before the run starts.Solution
_validate_artifact_input_limits(artifact_inputs, max_file_size=None, max_file_count=None)toCRSCompose.OSS_CRS_MAX_INPUT_FILE_SIZE(maximum byte size per file) andOSS_CRS_MAX_INPUT_FILE_COUNT(maximum number of files within an input directory).CRSCompose.run()immediately after syntax validation.oss_crs/tests/unit/test_directed_inputs_behavior.pycovering:OSS_CRS_MAX_INPUT_FILE_SIZE,OSS_CRS_MAX_INPUT_FILE_COUNT).CHANGELOG.mdunder[Unreleased] ### Added.Testing
uv run pytest oss_crs/tests/unit/test_directed_inputs_behavior.py(23 passed)uv run ruff check oss_crs/src/crs_compose.py oss_crs/tests/unit/test_directed_inputs_behavior.py(passed)uv run ruff format --check oss_crs/src/crs_compose.py oss_crs/tests/unit/test_directed_inputs_behavior.py(passed)uv run pyright oss_crs/src/crs_compose.py oss_crs/tests/unit/test_directed_inputs_behavior.py(0 errors)