Skip to content

chore: harden S3 download path handling#5984

Open
lucasjia-aws wants to merge 1 commit into
aws:master-v2from
lucasjia-aws:fix/s3-path-traversal-v2
Open

chore: harden S3 download path handling#5984
lucasjia-aws wants to merge 1 commit into
aws:master-v2from
lucasjia-aws:fix/s3-path-traversal-v2

Conversation

@lucasjia-aws

Copy link
Copy Markdown
Collaborator

Align master-v2 with master by validating that files downloaded from S3 resolve within the intended destination directory before writing. Adds a shared validate_path_within_directory() helper in sagemaker.utils and wires it into the S3 download paths in _download_files_under_prefix, Session.download_data, mlflow.utils._download_s3_artifacts, and the local transform job.

Includes unit tests for the new validation behavior.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Align master-v2 with master by validating that files downloaded from
S3 resolve within the intended destination directory before writing.
Adds a shared validate_path_within_directory() helper in
sagemaker.utils and wires it into the S3 download paths in
_download_files_under_prefix, Session.download_data,
mlflow.utils._download_s3_artifacts, and the local transform job.

Includes unit tests for the new validation behavior.
@lucasjia-aws lucasjia-aws requested a review from a team as a code owner July 1, 2026 21:17
@lucasjia-aws lucasjia-aws requested a review from jam-jee July 1, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant