Skip to content

fix: harden S3 download path handling - #5984

Merged
lucasjia-aws merged 1 commit into
aws:master-v2from
lucasjia-aws:fix/s3-path-traversal-v2
Jul 8, 2026
Merged

lucasjia-aws merged 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.

@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
@lucasjia-aws
lucasjia-aws force-pushed the fix/s3-path-traversal-v2 branch from ea6588e to 56f93fb Compare July 7, 2026 19:48
@lucasjia-aws
lucasjia-aws force-pushed the fix/s3-path-traversal-v2 branch from 56f93fb to 0e4ecc7 Compare July 7, 2026 21:49
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 force-pushed the fix/s3-path-traversal-v2 branch from 0e4ecc7 to c8cf415 Compare July 8, 2026 02:58
@lucasjia-aws

Copy link
Copy Markdown
Collaborator Author

Strict backport #5804 (fix for v3) to v2

@lucasjia-aws lucasjia-aws changed the title chore: harden S3 download path handling fix: harden S3 download path handling Jul 8, 2026
@lucasjia-aws
lucasjia-aws merged commit 87aa3a2 into aws:master-v2 Jul 8, 2026
9 of 11 checks passed
@lucasjia-aws
lucasjia-aws deleted the fix/s3-path-traversal-v2 branch July 27, 2026 19:15

This branch was previously deployed

1 inactive deployment
auto-approve — c8cf4152 Deployed Jul 8, 2026 by lucasjia-aws via wait-for-approval #187
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.

3 participants