Repository navigation
Limit embeds of speculative pages that aren't in scope - #838
Open
krushna-sahu1 wants to merge 2 commits into
Open
krushna-sahu1 wants to merge 2 commits into
krushna-sahu1 wants to merge 2 commits into
Conversation
TransclusionDecideRule accepts the embeds of a speculatively discovered page even when the page itself is out of scope, so a URL found in JavaScript that turns out to be an HTML page pulls in all of that page's resources. Add an optional speculativePageScope rule. When set, URIs discovered from an HTML page reached by a speculative hop are only transcluded if that rule accepts the page. Speculatively discovered non-HTML resources and redirects are unaffected.
The default profiles transcluded the embeds of every speculatively discovered page, including same-site pages beyond maxHops, which grew a single-page crawl of a news homepage to tens of thousands of URIs. Make the hop limit a named tooManyHops bean and set TransclusionDecideRule's speculativePageScope to accept pages within the SURT prefixes and hop limit.
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.
Fixes #826.
Speculative links (e.g. URLs found in JavaScript) are transcluded even when they're out of scope. When one turns out to be an HTML page, its own embeds get transcluded too, so a single-page crawl can end up pulling in the resources of hundreds of other pages.
This adds an optional
speculativePageScoperule toTransclusionDecideRule. If a URI was discovered from a 2xx HTML page that was reached by a speculative hop (ignoring redirects), it's only transcluded whenspeculativePageScopeaccepts that page. Speculatively discovered non-HTML resources (CDN images, JSON, CSS, JS etc.), their own embeds, and redirects work as before.In the default profiles, the hop limit is now a named
tooManyHopsbean, andspeculativePageScopeis[acceptSurts, tooManyHops]. So a speculative page only brings in its embeds if it would be in scope on its own, andmaxHopsis still set in one place.As described in the issue, with
maxHops=0the number of discovered URIs went from 51,677 to 2,610 for the BBC homepage, 10,851 to 1,473 for SMH and 7,228 to 2,611 for ABC, while the speculative non-HTML resources were kept.Tests:
TransclusionDecideRuleTestcovers embeds of out-of-scope speculative pages, in-scope speculative pages, speculative resources, redirects and non-HTML pages, plus the existing hop limits.ProfileCrawlerBeansTestpasses for both profiles.