-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
Fix htmlentities() is called on already converted data on import #2417
Conversation
The data exported by the teleporter is already converted by the htmlentities() method before. Therefore, we do not need to call it again during import, otherwise some characters will be displayed incorrectly Signed-off-by: Marius Hanl <[email protected]>
Thanks for your PR. This is related to the this issue: #1928 Sidenote: As discussed over there, I still think
as long as we have something hacky like this: I see two ways to go:
|
Ahh, I see, thanks for pointing that out.
I agree. It is a bit hacky at this point. And I can see that this can be a security risk as well. |
One idea that came to my mind is a |
I wouldn't want to add a new checkbox. Even with a note, users won't understand the implications. I tested your code and it's working as expected. We only need to decide if we see a risk, if the input is not sanitized. |
I'd rather like if we would keep the sanitation there. We should, instead, de-sanitatize when exporting. I know that this will not solve the issue for existing exports, however, I'm also not aware of anyone having been affected by this before. There just seems to be a lack of importance IMO to (possibly lightheaded) drop this here. I do see an attack vector with users importing specifically crafted teleporter archives because someone of Reddit told them that doing so will solve their problem XYZ. We know there will be folks just running stuff off the Internet they don't understand and simply "see" what happens. |
Jep, I agree. That was also my concern when I read #1928 and all linked comments. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
No longer relevant due to the removal of |
What does this PR aim to accomplish?:
The data exported by the teleporter is already converted by the
htmlentities()
method before. Therefore, we do not need to call it again during import, otherwise some characters will be displayed incorrectly.Example to reproduce this:
'abc'
as comment (don't forget the two single quotation marks)adlist
)'abc'
adlist
table via the teleporter. The JSON entry will also look like this"'abc'"
adlist.json
againadlist
)&#039;abc&#039;
'abc'
instead of'abc'
, as the data got converted again on import viahtmlentities()
How does this PR accomplish the above?:
Do not call
htmlenties()
on import as previously exported data is already converted withhtmlenties()
. You can check this also by checking the database.> sqlite3 gravity.db "SELECT * FROM adlist"
What documentation changes (if any) are needed to support this PR?:
/
By submitting this pull request, I confirm the following:
git rebase
)