Skip to content

core: prevent attribute truncation side-effects#11503

Merged
patrickhulce merged 2 commits into
GoogleChrome:masterfrom
csabapalfi:fix-truncated-url-requests
Oct 1, 2020
Merged

core: prevent attribute truncation side-effects#11503
patrickhulce merged 2 commits into
GoogleChrome:masterfrom
csabapalfi:fix-truncated-url-requests

Conversation

@csabapalfi

@csabapalfi csabapalfi commented Oct 1, 2020

Copy link
Copy Markdown
Contributor

Summary

This is a bug fix for attribute truncation that introduced unwanted additional requests to truncated URLs (e.g when truncating image src).

This PR makes sure that the getOuterHTMLSnippet page function appends the cloned element (used for manipulating attributes) to a template element to prevent any side effects (as proposed by @paulirish here: #11465 (comment))

Confirmed the fix by running my branch against this example repo: https://github.com/joshmcarthur/lighthouse-requesting-ellipsied-urls-repro

Related Issues/PRs
fixes #11465
#11244
#10984

@csabapalfi csabapalfi requested a review from a team as a code owner October 1, 2020 09:37
@csabapalfi csabapalfi requested review from patrickhulce and removed request for a team October 1, 2020 09:37
@csabapalfi csabapalfi changed the title fix(core): prevent attribute truncation making requests core: prevent attribute truncation making requests Oct 1, 2020
@csabapalfi csabapalfi marked this pull request as draft October 1, 2020 09:51
@csabapalfi csabapalfi changed the title core: prevent attribute truncation making requests core: prevent attribute truncation side-effects Oct 1, 2020
@csabapalfi csabapalfi force-pushed the fix-truncated-url-requests branch from 7a9da98 to fdcf489 Compare October 1, 2020 10:15

@patrickhulce patrickhulce left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for picking this up @csabapalfi!

Any ideas for a test for this? I'm struggling to come up with one that would actually catch this given our current infrastructure since it's only really observable on the server's side and we've stopped recording network requests in Lighthouse when this happens :/

impl LGTM though 🎉

Comment thread lighthouse-core/lib/page-functions.js Outdated
@googlebot

Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Oct 1, 2020

@patrickhulce patrickhulce left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks @csabapalfi! I filed #11506 for us to eventually follow up with a way to test this.

@patrickhulce patrickhulce merged commit 925cb1d into GoogleChrome:master Oct 1, 2020
@csabapalfi

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback and for merging it so quickly :)

@csabapalfi

csabapalfi commented Oct 1, 2020

Copy link
Copy Markdown
Contributor Author

@patrickhulce Do you maybe know if there's any chance this can somehow still make it into 6.4.0?

@patrickhulce

Copy link
Copy Markdown
Collaborator

Do you maybe know if there's any chance this can somehow still make it into 6.4.0?

No, sorry 6.4.0 finalized yesterday. Given that the issue has been around for several minor versions, I don't think it would qualify for an urgent, dedicated 6.4.1 release.

@csabapalfi

csabapalfi commented Oct 1, 2020

Copy link
Copy Markdown
Contributor Author

Ok, thanks! Makes sense.

@patrickhulce

Copy link
Copy Markdown
Collaborator

@csabapalfi it's your lucky day we're actually shipping a 6.4.1 due to a separate problem in #11513 😄

@patrickhulce patrickhulce mentioned this pull request Oct 2, 2020
@csabapalfi

Copy link
Copy Markdown
Contributor Author

Amaaazing! Thanks! 😎

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.

Long attribute value truncation fires off requests to the truncated URLs

4 participants