fix youtube embeds (#2394)

This commit is contained in:
Athou
2026-11-17 14:22:27 +01:00
parent d3ba47d200
commit e59948c68c
3 changed files with 10 additions and 2 deletions

View File

@@ -106,7 +106,14 @@ const Content = React.memo((props: ContentProps) => {
return ( return (
<BasicHtmlStyles> <BasicHtmlStyles>
<Box className={classes.content}> <Box className={classes.content}>
<Interweave content={props.content} transform={transform} matchers={matchers} allowList={allowList} /> <Interweave
content={props.content}
transform={transform}
matchers={matchers}
allowList={allowList}
// attributes are already sanitized server-side
allowAttributes
/>
</Box> </Box>
</BasicHtmlStyles> </BasicHtmlStyles>
) )

View File

@@ -140,6 +140,7 @@ public class FeedEntryContentCleaningService {
whitelist.addEnforcedAttribute("a", "target", "_blank"); whitelist.addEnforcedAttribute("a", "target", "_blank");
whitelist.addEnforcedAttribute("a", "rel", "noreferrer"); whitelist.addEnforcedAttribute("a", "rel", "noreferrer");
whitelist.addEnforcedAttribute("iframe", "referrerpolicy", "strict-origin-when-cross-origin");
return whitelist; return whitelist;
} }

View File

@@ -25,7 +25,7 @@ class FeedEntryContentCleaningServiceTest {
<p> <p>
Some text Some text
<img width="965" height="320" src="https://localhost/an-image.png" alt="alt-desc" style="width:100%;"> <img width="965" height="320" src="https://localhost/an-image.png" alt="alt-desc" style="width:100%;">
<iframe src="https://localhost/an-iframe" style="width:100%;"></iframe> <iframe src="https://localhost/an-iframe" style="width:100%;" referrerpolicy="strict-origin-when-cross-origin"></iframe>
aaa aaa
</p> </p>
""" """