You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/05/12 03:26:06 UTC

[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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix log server path extraction to use removeprefix [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
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.
   
   <table>
           <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>✅</td>
           <td>v3-2-test</td>
           <td><a href="https://github.com/apache/airflow/pull/66772"><img src="https://img.shields.io/badge/PR-66772-blue" alt="PR Link"></a></td>
       </tr>
   </table>


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix log server path extraction to use removeprefix [airflow]

Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix log server path extraction to use removeprefix [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org