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

'remove-cookie' scriptlet sometimes does not work #3293

Closed
9 tasks done
andris86 opened this issue Jul 8, 2024 · 6 comments
Closed
9 tasks done

'remove-cookie' scriptlet sometimes does not work #3293

andris86 opened this issue Jul 8, 2024 · 6 comments
Labels
wontfix won't be addressed

Comments

@andris86
Copy link

andris86 commented Jul 8, 2024

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 YouTube, Facebook or Twitch report. These sites MUST be reported by clicking their respective links.
  • 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

remove-cookie scriptlet does not sometimes remove a cookie. At discovermagazine.com rule discovermagazine.com##+js(remove-cookie,kserv-session) does not work. Logger shows the scriptlet but it does not have any effect on the cookie kserv-session.

But on nautil.us this scriptlet works as expected. Rule nautil.us##+js(remove-cookie,arc) succesfully removes cookie called arc.

I checked on Brave, Edge and Firefox Nightly. Can reproduce this issue on all three browsers.

A specific URL where the issue occurs.

https://www.discovermagazine.com/mind/what-does-it-mean-to-be-an-ambivert

Steps to Reproduce

  1. Add discovermagazine.com##+js(remove-cookie,kserv-session) rule to custom filter and add that filter to filter list or to user filters.
  2. Open cookie list in browser devtools and put 'kserv-session' in filter so you can easily see what is happening with it.
  3. Open discovermagazine.com. You can use article I linked or open any other article.
  4. Logger shows that this scriptlet is correct and working but actually cookie called kserv-session was not removed. You can see in devtools that this cookie is still there.
  5. Open other articles. This cookie still isn't removed.

Expected behavior

Cookie is removed.

Actual behavior

Cookie didn't get removed.

uBO version

1.58.0

Browser name and version

Brave Version 1.67.123 Chromium: 126.0.6478.126

Operating System and version

Windows 11 10.0.22631

@uBlock-user
Copy link
Contributor

Despite the name, cookies are expired, not removed.

@stephenhawk8054
Copy link
Member

stephenhawk8054 commented Jul 9, 2024

kserv-session on that site is an HttpOnly cookie which cannot be removed by javascript

A cookie with the HttpOnly attribute can't be modified by JavaScript, for example using Document.cookie; it can only be modified when it reaches the server.

image

If you type document.cookie in the browser console, there's no kserv-session value.

@andris86
Copy link
Author

andris86 commented Jul 9, 2024

I tried to remove AWSALBTG cookie using rule discovermagazine.com##+js(remove-cookie,AWSALBTG) but it didn't work and this cookie is not httponly.

@stephenhawk8054
Copy link
Member

It depends on whether the site sets the cookie again after uBO removing it or not.

@D4niloMR
Copy link

D4niloMR commented Jul 9, 2024

When the modification of request headers is implemented, we should be able to remove kserv-session from the request header.

For AWSALBTG cookie, you can add discovermagazine.com##+js(remove-cookie, AWSALBTG, when, scroll)

@gorhill
Copy link
Member

gorhill commented Jul 10, 2024

There is no guarantee the cookie is still removed after the scriptlet execute when the site keeps setting it -- there is no cookie-blocking API in the DOM. There is an experimental CookieChangeEvent but currently not available in Firefox -- so this may be used in the future when support is present for all browsers.

@gorhill gorhill added the wontfix won't be addressed label Jul 10, 2024
@gorhill gorhill closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix won't be addressed
Projects
None yet
Development

No branches or pull requests

5 participants