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

core: prevent attribute truncation side-effects #11503

Merged

Conversation

csabapalfi
Copy link
Contributor

@csabapalfi csabapalfi commented Oct 1, 2020

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
Copy link
Collaborator

@patrickhulce patrickhulce left a comment

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 🎉

lighthouse-core/lib/page-functions.js Outdated Show resolved Hide resolved
@googlebot
Copy link

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

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

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

@patrickhulce patrickhulce left a comment

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
Contributor Author

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

@csabapalfi
Copy link
Contributor Author

csabapalfi commented Oct 1, 2020

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

@patrickhulce
Copy link
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
Copy link
Contributor Author

csabapalfi commented Oct 1, 2020

Ok, thanks! Makes sense.

@patrickhulce
Copy link
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
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