Re: [PR] Fix log server path extraction to use removeprefix [airflow]
github-actions[bot] commented on PR #66749: URL: https://github.com/apache/airflow/pull/66749#issuecomment-4431663403 ### Backport successfully created: v3-2-test Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x) the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches. In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel. Status Branch Result ✅ v3-2-test https://github.com/apache/airflow/pull/66772";>https://img.shields.io/badge/PR-66772-blue"; alt="PR Link"> -- 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]
Re: [PR] Fix log server path extraction to use removeprefix [airflow]
vatsrahul1001 merged PR #66749: URL: https://github.com/apache/airflow/pull/66749 -- 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]
Re: [PR] Fix log server path extraction to use removeprefix [airflow]
potiuk closed pull request #66749: Fix log server path extraction to use removeprefix URL: https://github.com/apache/airflow/pull/66749 -- 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]
[PR] Fix log server path extraction to use removeprefix [airflow]
potiuk opened a new pull request, #66749:
URL: https://github.com/apache/airflow/pull/66749
## Summary
The log server uses `request.url.path.lstrip("/log/")` to extract the
requested filename from the URL path. `str.lstrip()` strips any combination of
the argument characters (here `{/, l, o, g}`) from the left of the string — it
does **not** remove the literal prefix `"/log/"`. This is a documented Python
pitfall (see https://docs.python.org/3/library/stdtypes.html#str.lstrip).
This PR switches to `str.removeprefix("/log/")` (Python 3.9+, already
required by Airflow) so the filename extracted for JWT validation matches the
one the underlying Starlette `StaticFiles` mount uses to locate the file on
disk.
## Test plan
- [x] New `test_forbidden_lstrip_character_overlap` in
`airflow-core/tests/unit/utils/test_serve_logs.py` exercises the `{/, l, o, g}`
character-set overlap.
- [x] Existing `test_serve_logs.py` tests continue to pass.
Tracker: airflow-s/airflow-s#401.
# Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Opus 4.7 (1M context)
Generated-by: Claude Opus 4.7 (1M context) following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions
--
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]
