Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Warn about urlsplit()'snetloc not being suitable for open redirect checking #142412

Open
Labels
docsDocumentation in the Doc dir
@ThiefMaster

Description

@ThiefMaster
>>>fromurllib.parseimporturlsplit>>>urlsplit('//example.com')SplitResult(scheme='',netloc='example.com',path='',query='',fragment='')>>>urlsplit('///example.com')SplitResult(scheme='',netloc='',path='/example.com',query='',fragment='')>>>urlsplit('////example.com')SplitResult(scheme='',netloc='',path='//example.com',query='',fragment='')

This greatly differs from how browsers interpret it:Location: ////example.com will redirect you toexample.com, which makes checking for a non-emptynetloc to avoid open redirects useless.

I tested using Firefox (which starts treating it as a netloc starting with 4 slashes).httpie on the other hand does not have this problem, andcurl simply rejects such invalid redirects. So it is most likely a a case of browsers simply tolerating garbage instead of refusing it.

I think a warning in the docs that it is not suitable for checking against open redirects may be a nice thing to add...

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp