Skip to content

reject backslash-after-scheme urls in is_safe_url - #70215

Merged
pierrejeambrun merged 1 commit into
apache:mainfrom
Samin061:safe-url-backslash-scheme
Jul 27, 2026
Merged

reject backslash-after-scheme urls in is_safe_url#70215
pierrejeambrun merged 1 commit into
apache:mainfrom
Samin061:safe-url-backslash-scheme

Conversation

@Samin061

Copy link
Copy Markdown
Contributor

is_safe_url in airflow-core/src/airflow/api_fastapi/core_api/security.py rejects a leading //, /\, \/ and \\, but not a backslash that follows the scheme, so https:\\evil.com is parsed by urllib as a relative path, urljoin re-attaches the base netloc, and the netloc comparison passes. Browsers follow WHATWG, where \ is / for special schemes, so the same string navigates to https://evil.comGET /auth/token/login?next=https:\\evil.com returns it verbatim as the redirect location and GET /auth/login?next= forwards it to the auth manager login page, both without authentication. Normalising backslashes to forward slashes before the prefix check and the parse makes the helper agree with the parser that actually resolves the value; the second unquote goes away with it so the guard and the resolution look at the same string.


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

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@pierrejeambrun
pierrejeambrun merged commit eeeb6f0 into apache:main Jul 27, 2026
79 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
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 Slack channel.

Status Branch Result
v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 27, 2026
…#70215)

(cherry picked from commit eeeb6f0)

Co-authored-by: Samina <sam@bugqore.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jul 27, 2026
…#70215)

(cherry picked from commit eeeb6f0)

Co-authored-by: Samina <sam@bugqore.com>
pierrejeambrun pushed a commit that referenced this pull request Jul 27, 2026
#70515)

(cherry picked from commit eeeb6f0)

Co-authored-by: Samina <sam@bugqore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API backport-to-v3-3-test Backport to v3-3-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants