Skip to content

bpo-35647: Fix path check in cookiejar #11436

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

Merged
merged 5 commits into from
Mar 10, 2019

Conversation

tirkarthi
Copy link
Member

@tirkarthi 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

@tirkarthi
Copy link
Member Author

@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 bpo35121-cookie-path branch from 16a6959 to de2c5a4 Compare January 16, 2019 19:23
@ned-deily
Copy link
Member

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

Copy link
Member

@alex alex left a comment

Choose a reason for hiding this comment

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

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.

@alex alex added the type-security A security issue label Mar 10, 2019
Copy link
Member

@orsenthil orsenthil left a comment

Choose a reason for hiding this comment

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

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
@bedevere-bot
Copy link

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

@miss-islington
Copy link
Contributor

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
Copy link

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

@bedevere-bot
Copy link

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

miss-islington pushed 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 pushed 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
Copy link
Member Author

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 pushed a commit that referenced this pull request Mar 12, 2019
Co-authored-by: Xtreak <tir.karthi@gmail.com>
larryhastings pushed 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 pushed 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-security A security issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants