Skip to content

Conversation

@GenericMale
Copy link

What does this PR do?

This PR modifies the clear_cookies function to now only delete cookies related to user preferences. It also adjusts the cookie display logic to only show these relevant preference cookies. This ensures that session cookies and other non-preference cookies are preserved, preventing unintended side effects (see #3763).

Why is this change important?

Previously, the clear_cookies function was deleting all cookies, including cookies from other services on the same domain, session cookies etc.

How to test this PR locally?

  1. Navigate to the preferences page.
  2. Set and save some user preferences.
  3. Navigate to the cookies tab.
  4. Verify all searxng cookies are shown but no other cookies. Foreign cookies can be simulated using Javascript, e.g. document.cookie = "username=John Doe" in the Browser console
  5. Click the "Reset defaults" button.
  6. Verify all searxng cookies are deleted but other cookies are preserved.

Related issues

Closes #3763

@return42
Copy link
Member

return42 commented Jan 6, 2025

I still hesitate to merge this PR since I have a few doubts:

Name collisions with other apps on the same domain are not solved (e.g. language and theme are very common) and problematic code mentioned by @glanham-jr in #3763 (comment) is not addressed -> I think the preference code needs a complete review .. meanings?

@GenericMale
Copy link
Author

I still hesitate to merge this PR since I have a few doubts:

Name collisions with other apps on the same domain are not solved (e.g. language and theme are very common) and problematic code mentioned by @glanham-jr in #3763 (comment) is not addressed -> I think the preference code needs a complete review .. meanings?

hasn't the mentioned "problematic" code been removed in #3966 or is this something else?

in my opinion the very generic names of the cookies used by SearXNG is a related but different issue which will obviously require a lot more work (and some sort of migration) than this small improvement which (hopefully) has minimal impact but ensures SearXNG will not touch any cookies it doesn't know about at all (which imho is required in any case).

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

Successfully merging this pull request may close these issues.

Preferences show and overwrite unknown cookies

3 participants