mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2026-02-03 06:03:25 +00:00
Add option to disable inline handler #187
Reference in New Issue
Block a user
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?
Originally created by @stek29 on GitHub.
inline handler can be considered insecure (especially for self-hosted installations), since it allows direct view of any file type, including html files.
and allowing inline handler for html files leads to stored XSS via user uploaded content.
example: https://transfer.sh/inline/qEksd/test.html
@stek29 commented on GitHub:
Is content type sanitized in any way? MIME types are case insensitive afaik, and from what i see it’s not lowercased anywhere
@paolafrancesca commented on GitHub:
@stek29 I think that instead of disabling the inline handler we could sanitize the html content using bluemonday (https://github.com/microcosm-cc/bluemonday).
It's just a matter of adding at https://github.com/dutchcoders/transfer.sh/blob/master/server/handlers.go#L1011
What do you think?
any content type other than
text/htmlto sanitize?@paolafrancesca commented on GitHub:
you are right @stek29 :
https://github.com/dutchcoders/transfer.sh/blob/master/server/handlers.go#L476-L480
I forgot that we use
mime.TypeByExtension(that's lowercase) only ifcontent-typeheader is emtpyI will apply lowercase here: https://github.com/dutchcoders/transfer.sh/blob/master/server/handlers.go#L386
@paolafrancesca commented on GitHub:
fixed with #347
@stek29 commented on GitHub:
@aspacca your solution seems good enough (.Contains html)
I’d still prefer to have an option to disable inline handler completely tbh, but yeah, it’s good enough
@paolafrancesca commented on GitHub:
@stek29 https://github.com/dutchcoders/transfer.sh/pull/355
what do you think?
I also reduced sanitzation to inline content disposition: ie, when you download the file you want it to be the original one
@stek29 commented on GitHub:
@aspacca do you mind making a release including these two fixes?
@paolafrancesca commented on GitHub:
done!