Search code examples
xmlbrowserrssumbraco

Script Tag in RSS Feed


I have created a RSS feed for an Umbraco blog. As per below, a function enclosed in script tags appears in the generated XML which means that it fails RSS validation with the error 'Undefined rss element: script' (as per https://validator.w3.org/feed/). I have no idea why this script tag appears. The RSS XML definition (further below) does not contain it and I can find no reference to the function or its contents in the code base.

Is anyone able to shed any light on why this script tag and its contents appear? I need to remove it in order to pass RSS validation. Thank you.

I'm currently only testing this on localhost.

<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
<script>
(function(){EventTarget.prototype.ol_originalAddEventListener=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.ol_originalAddEventListener(t,e,r),"click"===t&&setTimeout(function(){!window.OL_NOT_LOGIN_PAGE&&n.setAttribute&&n.setAttribute("data-ol-has-click-handler","")},0)}})("")
</script>
<channel>
<title>Script Tag in RSS XML...</title> etc
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:slash="http://purl.org/rss/1.0/modules/slash/">

    <channel>
        <title>@FEED_TITLE</title>
        <atom:link href="@feedUrl" rel="self" type="application/rss+xml" />
        <link>@feedParentPage.UrlWithDomain()</link>
        <description>@FEED_DESCRIPTION</description>
        <lastBuildDate>@lastBuildDate.ToString("r")</lastBuildDate>
        <language>@LANGUAGE</language>
        <sy:updatePeriod>@UPDATE_PERIOD</sy:updatePeriod>
        <sy:updateFrequency>@UPDATE_FREQUENCY</sy:updateFrequency>
        @foreach (IPublishedContent item in feedItems.OrderBy(ARTICLE_DATE_PROPERTY_ALIAS + " desc"))
        {
            string articleDescription = item.GetPropertyValue<string>(INTRODUCTION_PROPERTY_ALIAS);
            @:<item>
                <title>@(item.HasProperty(ARTICLE_TITLE_PROPERTY_ALIAS) ? item.GetPropertyValue<string>(ARTICLE_TITLE_PROPERTY_ALIAS) : item.Name)</title>
                @:<link>
                @umbraco.library.NiceUrlWithDomain(item.Id)
                @:</link>
                <pubDate>@(((DateTime)item.GetPropertyValue(ARTICLE_DATE_PROPERTY_ALIAS)).ToString("r"))</pubDate>
                <dc:creator><![CDATA[@CREATOR_NAME]]></dc:creator>
                <category><![CDATA[@CATEGORY]]></category>
                <guid isPermaLink="false">@item.UrlWithDomain()</guid>
                <description><![CDATA[@articleDescription]]></description>
            @:</item>
        }
    </channel>
</rss>

Solution

  • This script is injected by the OneLogin browser extension. I suggest that you disable it for that domain or remove it completely, and use a different (better) password manager like 1Password or LastPass.