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
Changed to make svg media urls link to the media file directly #12655
Conversation
Hi there @AaronSadlerUK, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There's a reason this was added when it comes to security, see PR #6182 Unlike an image a SVG can contain malicious JS content and could then execute inside of the back office. In this case we control the specific HTML to render instead of rendering the raw HTML directly, which can contain malicious JS and thus execute this. The In future we may use the new Sanitizer API: https://web.dev/sanitizer/
Not supported yet by default, but possible to enable in Firefox and Chrome: I also commented on this here: #6182 (comment) |
@bjarnef I'm not sure I understand how this would be a risk in the backoffice? The link would open the SVG in a new window via a direct link to the media file. This is what happens when you click on the svg in the Content tab anyway, so I can't see what the PR you mentioned fixes here |
@nul800sebastiaan can you elaborate this based on the linked PR? |
When you click it in the backoffice it opens a new html document, wrapping the svg in an html I'll close this PR as it opens up a security issue. |
@nul800sebastiaan ok so what about the svg link on the Content tab? This also opens in a new window in the same way I'd expect the link on the Info tab to behave... Surely this is also a security risk? |
Yeah.. now I can see. I don't know since when this has been linked, it definitely shouldn't have been, not like this anyway. |
Prerequisites
If there's an existing issue for this PR then this fixes #12654
Description
This fixes the URL for SVG media items on the Info Tab in the backoffice so that it links directly to the media file.
It now works in the same way as if you click on the image on the Content tab.
I have commented out the code rather than remove it, as I'm not sure why it was added or what it was trying to achieve.