Skip to content
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

BUGFIX: Check SVG files for malicious code before providing original asset url links #4812

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

dlubitz
Copy link
Contributor

@dlubitz dlubitz commented Dec 21, 2023

This adds a check in the preview of assets in the media module and checks for malicous content in svgs. If detected, the direct links to the original url get removed from the preview pages and a warning is shown.

image

Fixes:

Neos.Media.Browser/Classes/Controller/AssetController.php Outdated Show resolved Hide resolved
</a>
<f:if condition="{assetContainsMaliciousContent}">
<f:then>
<img src="{assetProxy.previewUri}" class="img-polaroid" alt="{assetProxy.label}"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure the previewUri does never point to the potentially malicious content? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we don't. But the code is just excecuted if you open the file in the browser directly. It's not executed if you embed it in an img-tag.

</a>
<f:if condition="{assetContainsMaliciousContent}">
<f:then>
<img src="{assetProxy.previewUri}" class="img-polaroid" alt="{assetProxy.label}"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure the previewUri does never point to the potentially malicious content? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Co-authored-by: Karsten Dambekalns <karsten@dambekalns.de>
Copy link
Member

@kitsunet kitsunet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking care :)

Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for taking care!

I was just wondering about the positioning of the error message and what happens if the filename is longer.

Also: Would it make sense to still output the URL of the asset somehow even if it might contain malicious content?

Both definitely no reason to block this!

@dlubitz
Copy link
Contributor Author

dlubitz commented Jan 8, 2024

@bwaidelich Long filename just wrap

image

@kitsunet kitsunet merged commit 4ac0df0 into neos:7.3 Jan 10, 2024
8 checks passed
@dlubitz dlubitz deleted the bugfix/svg-sanitize-check branch January 10, 2024 13:41
@dlubitz
Copy link
Contributor Author

dlubitz commented Jan 15, 2024

Bugfix released with Neos Versions:

7.3.19
8.0.16
8.1.11
8.2.11
8.3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants