Repository navigation
fix: keep the item links of an RSS feed whose HTML contains <link> tags - #1002
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1002 +/- ##
=======================================
Coverage 99.95% 99.95%
=======================================
Files 21 21
Lines 4291 4306 +15
=======================================
+ Hits 4289 4304 +15
Misses 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
CodeQL flagged the regex I used to find the RSS root (nested repetitions could backtrack on a crafted feed). It is now a small linear scan over the XML declaration, comments and doctype, with tests for the adversarial inputs CodeQL described. All checks pass now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
find_links()treats a feed as Atom as soon as it contains any<link ... href=...>tag. An RSS feed can contain one in the HTML of an item, for example<link rel="stylesheet" href="...">inside a<description>CDATA block. Such a feed was then read as Atom:extract_links()returned only that stylesheet URL, and all the<link>elements of the items were lost.A feed whose root element is
<rss>or<rdf:RDF>(after the XML declaration, comments and doctype) and that has<link>elements is now read as RSS first. Atom feeds, JSON feeds, and RSS feeds without<link>elements behave as before. Added a test with an RSS 2.0 and an RSS 1.0 feed whose item HTML contains a<link>tag.