Skip to content

prevent path traversal in s3 to sftp/ftp transfer destinations#68984

Merged
o-nikolas merged 3 commits into
apache:mainfrom
Samin061:s3-transfer-path-traversal
Jun 30, 2026
Merged

prevent path traversal in s3 to sftp/ftp transfer destinations#68984
o-nikolas merged 3 commits into
apache:mainfrom
Samin061:s3-transfer-path-traversal

Conversation

@Samin061

Copy link
Copy Markdown
Contributor

S3ToSFTPOperator and S3ToFTPOperator build the remote destination by concatenating S3 key suffixes returned by list_keys onto the configured sftp_path/ftp_path, so an object whose name contains ../ segments resolves outside that directory on the SFTP/FTP server and the upload lands wherever the server canonicalises it. Object names are arbitrary strings controlled by anyone who can write to the source bucket, so the resolved destination is validated to stay within the configured path before uploading, mirroring the existing gcs_to_sftp and gcs_to_samba guards.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

@Samin061
Samin061 requested a review from o-nikolas as a code owner June 25, 2026 12:30
@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Jun 25, 2026
@boring-cyborg

boring-cyborg Bot commented Jun 25, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

Comment thread providers/amazon/src/airflow/providers/amazon/aws/transfers/s3_to_sftp.py Outdated
@o-nikolas
o-nikolas merged commit 1161cf9 into apache:main Jun 30, 2026
153 of 154 checks passed
@boring-cyborg

boring-cyborg Bot commented Jun 30, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants