Miretpl commented on code in PR #72162:
URL: https://github.com/apache/airflow/pull/72162#discussion_r3994035220


##########
providers/amazon/src/airflow/providers/amazon/aws/log/s3_task_handler.py:
##########
@@ -84,6 +84,18 @@ def upload(self, path: os.PathLike | str, ti: RuntimeTI | 
None = None) -> None:
             local_loc = self.base_log_folder.joinpath(path)
             remote_loc = os.path.join(self.remote_base, path)
 
+        # The log path is supplied by the caller and is not guaranteed to stay 
within
+        # ``base_log_folder``: ``joinpath`` and ``PurePath.relative_to`` are 
purely lexical and
+        # do not normalise ``..``. Without this check a traversing path would 
have its contents
+        # uploaded to the remote log store and, with ``delete_local_copy``, 
its parent directory
+        # removed. Mirrors the containment check in 
``CloudWatchRemoteLogIO.upload``.

Review Comment:
   I would remove that comment. It basically describes what a couple of lines 
underneath are doing. The same goes for other files.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to