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

Remove any script tags from generated feed xml #69

Open
kirrg001 opened this issue May 9, 2017 · 3 comments
Open

Remove any script tags from generated feed xml #69

kirrg001 opened this issue May 9, 2017 · 3 comments

Comments

@kirrg001
Copy link

kirrg001 commented May 9, 2017

Hey! 👋

In my opinion node-rss should remove all script (e.g. iframe) tags from a generated feed, because some rss validators show the following warnings/recommendations:

content:encoded should not contain iframe tag
description should not contain iframe tag

These warnings occur if you add custom_elements like

item.custom_elements.push({
  'content:encoded': {
    _cdata: "<iframe width="560" height="315" src="..." frameborder="0" allowfullscreen></iframe>"
  }
});

Refs https://validator.w3.org/feed/docs/warning/SecurityRisk.html

As this is a rule, it might be helpful for everybody. Let me know if you think that the caller should remove script tags by himself.

@ErisDS
Copy link
Collaborator

ErisDS commented May 9, 2017

@kirrg001 I'm the maintainer here ;)

I think the best approach for a non-breaking change would be to add a flag that is disabled by default, but when enabled auto-removes iframes? Possibly the same for #49, and then we can turn those features on by default for a 2.0.0 release?! 🤔

@kirrg001
Copy link
Author

kirrg001 commented May 9, 2017

yeah great idea 👍

@jochenkirstaetter
Copy link

jochenkirstaetter commented Jan 10, 2019

Hi,

That would be great. Discovered today that my automatic blog post distribution using Feedburner did not fire due to invalid RSS feed. I run into both issue #49 and this one. I'm using Ghost as blogging platform (came from their issue #8442 here).

  • XML parsing error: :131:3519: not well-formed (invalid token)
  • content:encoded should not contain iframe tag
  • content:encoded should not contain script tag
  • content:encoded should not contain data-lang attribute

The iframe is related to the Youtube card, and script element is based on the Twitter card in Ghost's editor.

I'm going to apply @ErisDS's ensureValid method from your branch to check whether invalid characters are going to be resolved.

Cheers, JoKi

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

No branches or pull requests

3 participants