CSRF and XSS mitigation #44
Labels
No labels
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Plume/Plume#44
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
from what I see, I think there is currently no mitigation against CSRF (ability to post from another website with a specialy crafted link, without secret cookie knoledge), nor against XSS (run js from untrusted input, maybe even from other instances sending comments)
XSS are mostly here because templates in
.teraare not auto-escaped, we should rename each template file into.html.teraso they areIs there any rules on where html should be allowed, but then sanitized (like posts i guess), and where it is not and can simply be escaped? I don't think comments requires html but from the code, currently they seems to be allowed to.
There is a crate to help handling CSRF: https://crates.io/crates/csrf
New xss were added when a dashboard was added (only work agaist themself), and during template deduplication (work again anybody and hit any template which include
/templates/users/header.tera). We should take care on not forgeting to add.htmlbefore.terato notify tera we need it to auto-escape htmlTera don't seems to auto escape arguments of functions, this allow an xss on user's name in
macro.html.tera,users/followers.html.tera,templates/posts/details.html.tera, via instance name intemplates/instance/index.html.tera(which is a bit of a none issue as admin can modify template if they want to), and maybe in other locations, even if the proper extension is used.I've fixed the two issues you mentioned, I think we are now protected. You can close this issue if you think everything is OK. 🙂
I can't spot any xss right now, however there is still a csrf issue on like reshare and follow as they are get requests. I think I'll close this and open another issue so peoples who know how to make a form beautifull can see it.
Oh yes, I forgot about them.