The GitHub Actions job "Tests" on airflow.git/v3-2-test has succeeded.
Run started by GitHub user potiuk (triggered by potiuk).

Head commit for run:
57cf697bf5ec0f1c072cc096b38210f93d5bcc86 / github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
[v3-2-test] Refuse to follow log symlinks that resolve outside the base log 
folder (#65325) (#65345)

* Refuse to follow log symlinks that resolve outside the base log folder

FileTaskHandler._read_from_local used to open every file that matched
the task's log glob pattern, including symlinks whose real path was
outside the configured base_log_folder. On deployments where worker
logs are accessible from the api-server, that meant the log viewer
could end up streaming content from files outside the configured log
tree whenever a symlink in the task log directory happened to match
the glob pattern.

Canonicalise self.local_base once via os.path.realpath and, for every
glob hit, resolve the path with os.path.realpath and skip it if the
resolved form is not contained in the canonicalised base log folder
(using os.path.commonpath, with a ValueError fallback for the
different-drive case on Windows). Open the resolved path rather than
the original glob hit so the file we open is the one we just
validated. Append to sources only after a successful open so sources
and log_streams stay aligned.

Drop the @staticmethod decorator so the method can read
self.local_base; existing call sites already invoke it via self.

Add a test class covering: regular-file-inside-base is still streamed;
a symlink whose real path is outside base_log_folder is skipped; a
symlink that stays inside base_log_folder is followed (legitimate
rotation case); and base_log_folder itself being a symlink works.

Generated-by: Claude Opus 4.6 (1M context) following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

* Fix test__read_from_local to use valid base_log_folder

The existing test passed an empty string as base_log_folder, which
after the containment check resolves to CWD via os.path.realpath(""),
causing all files under tmp_path to be rejected. Use tmp_path instead.
(cherry picked from commit 3eda84547e743397ec1027733f97d37ab2e628b4)

Co-authored-by: Jarek Potiuk <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/24489497901

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to