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

Instance properties of 'Response' issue in scriptlet and redirect #2526

Closed
7 of 8 tasks
piquark6046 opened this issue Mar 5, 2023 · 9 comments
Closed
7 of 8 tasks

Comments

@piquark6046
Copy link
Member

piquark6046 commented Mar 5, 2023

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

Screencast.from.2023-03-05.09-17-53.webm
Screencast.from.2023-03-05.09-16-58.webm

A specific URL where the issue occurs.

https://piquark6046.github.io/testpage/FetchResponse/

Steps to Reproduce

The step to reproduce is attached in the video.

piquark6046.github.io##+js(no-fetch-if, adsbygoogle.js)
||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js$redirect=googlesyndication_adsbygoogle.js
@@||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

Expected behavior

Instance properties of Response return consistently like an unblocked request.

Actual behavior

Instance properties of Response return various values.

uBO version

1.47.2 (Firefox); 1.47.4 (Brave)

Browser name and version

Mozilla Firefox Developer Edition 111.0b8; Brave 1.48.171

Operating System and version

Ubuntu 22.10

@uBlock-user
Copy link
Contributor

same as #2518 but this one is about fetch() ?

@piquark6046
Copy link
Member Author

#2518 issue can be handled by creating a Proxy for only XMLHttpRequest.prototype.getResponseHeader and XMLHttpRequest.prototype.getAllResponseHeaders.

But, to resolve this, uBO handles Response.prototype.redirected, Response.prototype.url and Response.prototype.headers.

@uBlock-user
Copy link
Contributor

uBlock-user commented Mar 5, 2023

Something to mind -

image

^ As long as above CORS policy remains in effect, browser will not allow data: stub resources from the extensions to load(resulting in a failed redirect), invariably causing different values to appear in the above case as well as in #2518

@gwarser
Copy link

gwarser commented Mar 5, 2023

Real use case where it is actually needed?

@piquark6046
Copy link
Member Author

Real use case where it is actually needed?

@piquark6046
Copy link
Member Author

piquark6046 commented Mar 17, 2023

A real world case found.
In this case, AdGuard Browser Extension 4.1.53 is not affected.

It was a mistake.

@MasterKia

This comment was marked as duplicate.

MasterKia referenced this issue in uBlockOrigin/uAssets Aug 13, 2023
Unfortunately, the flawed conclusions people are reaching because of
this flawed tool are all over the place, including some spamming results
from this pointless tools in uBO's own thread on Wilders Security despite
advises to refrain from using the tool to evaluate content blockers.
gorhill added a commit to gorhill/uBlock that referenced this issue Nov 25, 2023
Related issue:
uBlockOrigin/uBlock-issues#2526

Improvements:

Support fulfilling the response with the content of a
`web_accessible_resources` resource, using the syntax already
supported by `prevent-xhr`: `war:[name of resource]`

Support fulfilling the response with randomized text with length
specified using `length:min[-max]` directive.
@uBlock-user
Copy link
Contributor

@piquark6046 now you can use piquark6046.github.io##+js(no-fetch-if, adsbygoogle.js, war:googlesyndication_adsbygoogle.js)

@gorhill
Copy link
Member

gorhill commented Nov 29, 2023

Closing as fixed, in current dev build.

I didn't add Expires response header: it's an optional header and one of many others, I don't think it's a good for now to start arbitrarily adding response headers.

@gorhill gorhill closed this as completed Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants