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

SimplePie replace iframe allow attribute #6274

Merged
merged 4 commits into from
Apr 11, 2024

Conversation

Alkarex
Copy link
Member

@Alkarex Alkarex commented Apr 8, 2024

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#iframes

Besides security, the allow autoplay atttribute is especially problematic on mobile (Firefox on Android) as it asks to open the YouTube app as soon as the article is opened.
So we allow what is needed for a YouTube video to work fine, but not autoplay.

Example of code before:

<iframe data-original="https://www.youtube.com/embed/??????feature=oembed"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen=""
sandbox="allow-scripts allow-same-origin"></iframe>

Example of feed https://www.lexpress.fr/arc/outboundfeeds/rss/alaune.xml

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#allow

Besides security, the `allow autoplay` atttribute is especially problematic on mobile (Firefox on Android) as it asks to open the YouTube app as soon as the article is opened.

Example of code before:

```html
<iframe data-original="https://www.youtube.com/embed/??????feature=oembed" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" sandbox="allow-scripts allow-same-origin"></iframe>
```
@Alkarex Alkarex added this to the 1.24.0 milestone Apr 8, 2024
@Alkarex Alkarex changed the title SimplePie strip iframe allow attribute SimplePie replace iframe allow attribute Apr 8, 2024
$simplePie->add_attributes([
'audio' => ['controls' => 'controls', 'preload' => 'none'],
'iframe' => [
'allow' => 'accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share',
Copy link
Member Author

@Alkarex Alkarex Apr 8, 2024

Choose a reason for hiding this comment

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

Relevant line, which does not include autoplay

@Alkarex Alkarex merged commit 7aaed60 into FreshRSS:edge Apr 11, 2024
2 checks passed
@Alkarex Alkarex deleted the simplepie-strip-iframe-allow branch April 11, 2024 06:48
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

1 participant