-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support SVG avatars #8707
Comments
I think it's the same. Since it cannot be rendered safely, we cannot allow it uploaded. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
This issue has been automatically closed because of inactivity. You can re-open it if needed. |
The issue still occurs. Would be great if it get reopen. |
I don't know if there is a risk for that. |
Some reference:
|
Thanks for the references. The error message "The uploaded file is not an image." is the locale value for the variable "uploaded_avatar_not_a_image" which is present in the 2 files "routers/web/repo/setting.go" and "routers/web/user/setting/profile.go". For an uploaded image there is the following content type check. st := typesniffer.DetectContentType(data)
if !(st.IsImage() && !st.IsSvgImage()) {
return errors.New(ctx.Tr("settings.uploaded_avatar_not_a_image"))
} EDIT: I've found the line where it is rejected. It's the second ! in the function above |
If there is a battle-tested SVG sanitizer available in golang, we could reconsider. |
@silverwind I've done a quick search on gh and Google for one, but unfortunately I found just a few simple tag cleaners (removes script tags, so far away from battle tested). As far as I have seen, the current method for providing security with svgs is by using an adequate content security policy (http header) or (better and) using img tags for displaying the svg image. Additionally I would suggest that svg uploads must be enabled in the ini config. I think the gitea admins should be able to decide on their own if they want to use this functionality and eventually have a rest risk of that it can be exploited. For a public instance it can make sense to forbid it, but for private instances the adminis should have the possibility to allow it. |
SVG images are not supported as avatars (cannot be uploaded, reported to "not be an image").
I'm not sure this is a duplicate of #1095 so I'm filing it separately
The text was updated successfully, but these errors were encountered: