Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35647: Fix path check in cookiejar #11436

Merged
merged 5 commits into from Mar 10, 2019

Conversation

@tirkarthi
Copy link
Member

tirkarthi commented Jan 5, 2019

  • Fixes path_return_ok to use RFC 6265 path-match algorithm. Fix set_ok_path which also had similar bug in prefix check which now uses path_return_ok itself.
  • NEWS entry might need rewording. Any suggestions would be helpful since I am not a native speaker.

https://bugs.python.org/issue35647

Lib/http/cookiejar.py Outdated Show resolved Hide resolved
@tirkarthi

This comment has been minimized.

Copy link
Member Author

tirkarthi commented Jan 13, 2019

@serhiy-storchaka It would be helpful if you can review this since you had reviewed #10258 . The RFC has a section weak integrity about this

servers SHOULD NOT both run mutually
distrusting services on different paths of the same host and use
cookies to store security-sensitive information.

So opinions on if this is worthy enough of considering it as a security fix to backport to 3.6 or to have this as a regular bug fix to 3.7 and master would be helpful.

cc: @ned-deily

@tirkarthi tirkarthi force-pushed the tirkarthi:bpo35121-cookie-path branch from 16a6959 to de2c5a4 Jan 16, 2019
@ned-deily

This comment has been minimized.

Copy link
Member

ned-deily commented Mar 10, 2019

@alex Any opinions on this? It would be good to get this resolved for 3.7.3rc1.

@alex
alex approved these changes Mar 10, 2019
Copy link
Member

alex left a comment

I'm not an expert in this code, so it'd be good to get someone more familiar with the http module, but the logic looks right to me.

Copy link
Member

orsenthil left a comment

I read the detailed description of this issue in (https://bugs.python.org/issue35647) (Thanks @tirkarthi )
Inclined to agree that, this is a security loophole that is being fixed.

+1 to back-porting this to supported versions of Python.

@orsenthil orsenthil merged commit 0e1f1f0 into python:master Mar 10, 2019
5 checks passed
5 checks passed
Azure Pipelines PR #20190116.31 succeeded
Details
bedevere/issue-number Issue number 35647 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Mar 10, 2019

@orsenthil: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Mar 10, 2019

Thanks @tirkarthi for the PR, and @orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒🤖

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Mar 10, 2019

GH-12267 is a backport of this pull request to the 3.7 branch.

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Mar 10, 2019

GH-12268 is a backport of this pull request to the 3.6 branch.

miss-islington added a commit to miss-islington/cpython that referenced this pull request Mar 10, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter
(cherry picked from commit 0e1f1f0)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
miss-islington added a commit to miss-islington/cpython that referenced this pull request Mar 10, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter
(cherry picked from commit 0e1f1f0)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
miss-islington added a commit that referenced this pull request Mar 10, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter
(cherry picked from commit 0e1f1f0)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@tirkarthi

This comment has been minimized.

Copy link
Member Author

tirkarthi commented Mar 10, 2019

Thanks Alex and Senthil for review and merge.

tirkarthi added a commit to tirkarthi/cpython that referenced this pull request Mar 11, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter

(cherry picked from commit 0e1f1f0)
tirkarthi added a commit to tirkarthi/cpython that referenced this pull request Mar 11, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter

(cherry picked from commit 0e1f1f0)
ned-deily added a commit that referenced this pull request Mar 12, 2019
Co-authored-by: Xtreak <tir.karthi@gmail.com>
larryhastings added a commit that referenced this pull request Mar 16, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter

(cherry picked from commit 0e1f1f0)
larryhastings added a commit that referenced this pull request Mar 16, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter

(cherry picked from commit 0e1f1f0)
ma8ma added a commit to ma8ma/cpython that referenced this pull request Apr 7, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter
arnolddumas added a commit to arnolddumas/cpython that referenced this pull request May 3, 2019
* Refactor cookie path check as per RFC 6265

* Add tests for prefix match of path

* Add news entry

* Fix set_ok_path and refactor tests

* Use slice for last letter
serhiy-storchaka added a commit that referenced this pull request Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.