-
Notifications
You must be signed in to change notification settings - Fork 446
Require an edit cookie to be able to view a comment to be edited. #683
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
Require an edit cookie to be able to view a comment to be edited. #683
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please rebase and remove the now unnecessary formatting commit.
I've verified this PR via the following methods:
Web interface
Creating a comment manually and editing it -> works
curl denied
Creating comment, note id=1, try curl 'http://localhost/id/1
-> 403 (as expected)
curl with cookie
Create comment, note id=1, cookie 1=WzIsImUzYjgyMDQwNTY1YmI0YmU2YjExZjc3OGEyZTNkZjMyN2VkMjBhM2IiXQ.YB_Puw.PjiKthPk4XotF-22aV11EoveROw
, try:
curl 'http://localhost:8080/id/1' --cookie '1=WzIsIjUwOWU2YzJkNTFlZDRkNjkwNjA5ODcxNzQzODljNzlhNzBlYjQ1NWMiXQ.YB_PKw.GPKGtzNFiHKIwxc3i3U1olTj2jY'
->
{"id": 1, "parent": null, "created": 1612697387.4656265, "modified": 1612697531.182028, "mode": 1, "text": "<p>Now</p>", "author": "Nameee", "website": "http://web.site", "likes": 0, "dislikes": 0, "notification": 0}
As expected, works
nosetests
nosetests --with-doctest --with-coverage --cover-package=isso --cover-html isso/
................................................................................
Name Stmts Miss Cover
-----------------------------------------------
isso/__init__.py 164 57 65%
isso/config.py 77 11 86%
isso/core.py 68 20 71%
isso/db/__init__.py 66 6 91%
isso/db/comments.py 135 20 85%
isso/db/preferences.py 17 0 100%
isso/db/spam.py 36 0 100%
isso/db/threads.py 15 1 93%
isso/dispatch.py 39 23 41%
isso/ext/__init__.py 10 0 100%
isso/ext/notifications.py 150 100 33%
isso/migrate.py 201 27 87%
isso/run.py 5 0 100%
isso/utils/__init__.py 75 8 89%
isso/utils/hash.py 67 3 96%
isso/utils/html.py 50 1 98%
isso/utils/http.py 39 25 36%
isso/utils/parse.py 43 2 95%
isso/views/__init__.py 36 8 78%
isso/views/comments.py 464 70 85%
isso/wsgi.py 103 23 78%
-----------------------------------------------
TOTAL 1860 405 78%
----------------------------------------------------------------------
Ran 80 tests in 5.242s
OK
isso/views/comments.py
Outdated
@@ -954,6 +960,7 @@ def count(self, environ, request, uri): | |||
@apiSuccessExample Counts of 5 threads: | |||
[2, 18, 4, 0, 3] | |||
""" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Begone!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's quite a few functions with that inconsistent spacing. Also technically the docstrings should be inside the functions, not outside of them. Fixing that feels a bit out-of-scope for this change. Maybe in the future there should be a docstring normalization pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That said, I'll remove that accidentally-introduced newline. No idea how that got in there!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - I think there's value in fixing some of the formatting, but mixing those changes in with other changes just makes everything harder to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thing I’ve found to be helpful is to make autopep8 part of the build process so that there’s never an opportunity for things to drift in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but that should also be a separate PR :)
0f32033
to
1d238d1
Compare
PR feedback applied. |
It'd still be swell if this could get merged in. |
Is there something keeping these improvements from being merged? |
1d238d1
to
2d48e0c
Compare
The only objection I saw was from a stray formatting commit, which I've now rebased away. |
That's a lot of CI failures though. None of the errors seem to have anything to do with my changes but I had rebased off |
Hmm, those CI failures do look like a pypi availability issue... @fluffy-critter maybe rebase again to trigger another CI run? |
3f9b055
to
1a0234d
Compare
Looks like the same errors are occurring. |
The looks like the latest Since the latest PR to get merged also has the CI runs failing, I'd advocate merging this PR since it introduces no CI regressions. |
Also, @fluffy-critter you inadvertently (?) slipped some local commits (5 in total) in while rebasing, please get rid of them. |
Ah, yeah, totally accidental. Will fix. |
1a0234d
to
6690a43
Compare
package.json
Outdated
@@ -4,11 +4,14 @@ | |||
"description": "lightweight Disquis alternative", | |||
"license": "MIT", | |||
"repository": "github:posativ/isso", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated, or do you need newer versions of these for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure how that change snuck in, I thought I’d reverted that file to the one on master.
isso/views/comments.py
Outdated
@@ -954,6 +960,7 @@ def count(self, environ, request, uri): | |||
@apiSuccessExample Counts of 5 threads: | |||
[2, 18, 4, 0, 3] | |||
""" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - I think there's value in fixing some of the formatting, but mixing those changes in with other changes just makes everything harder to review.
Oh, yeah, I absolutely agree.
…---
fluffy (she/her)
https://beesbuzz.biz/
On Dec 22, 2021, at 11:25 AM, Jelmer Vernooij ***@***.***> wrote:
@jelmer commented on this pull request.
In isso/views/comments.py <#683 (comment)>:
> @@ -954,6 +960,7 @@ def count(self, environ, request, uri):
@apiSuccessExample Counts of 5 threads:
[2, 18, 4, 0, 3]
"""
+
Sure, but that should also be a separate PR :)
—
Reply to this email directly, view it on GitHub <#683 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AACUYGVMLNJL4RYHZ7UGCKDUSIQ2JANCNFSM4WEWI2MQ>.
You are receiving this because you were mentioned.
|
6690a43
to
0ba8e4a
Compare
0ba8e4a
to
397d0d2
Compare
PR has been cleaned up and only has PR-specific changes in it now. Sorry about the temporary mess! |
The
/id
GET endpoint is only used to retrieve the raw text of a comment to be edited. Being able to arbitrarily retrieve any comment through this endpoint is a potential privacy issue, since it allows a malicious actor to individually retrieve all comments from a website without knowledge of an existing thread URI.This change requires that comment text retrieval has a valid edit cookie.
Fixes #679