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

Add the single cookie option #2

Closed
wants to merge 2 commits into from
Closed

Conversation

layoutd
Copy link
Collaborator

@layoutd layoutd commented Jan 17, 2024

Due to some issues with Sourcebuster cookies and some Web Application Firewalls (specifically, using Comodo's WAF ruleset), a handful of the cookies set by Sourcebuster are incorrectly flagged as suspicious, and users are blocked from visiting the host site.

The sbjs_current cookie is the only one that's whitelisted, so this PR modifies Sourcebuster behavior with a user flag to store all data as JSON in that single cookie.

It overrides the setter and getter for cookies, and adds them to an object, which is then saved as the single cookie's value. It also erases any other existing cookies (and should retrieve their values if upgrading).

Testing

  1. From trunk, build the project and host it, and visit the example site in /public/index.html
  2. Confirm that the existing Sourcebuster works as expected: correct sources, first and current, session and page visits, new tabs, close and reopen, etc.
    • You can visit the page in incognito windows or erase the cookies to reset the current/first values
    • You can also reduce the cookie lifetime to .000 and session time to 1 to simulate new sessions more quickly.
  3. Build this PR's version, and confirm that
    • There's only one cookie created
    • It's values are updated correctly: correct sources, first and current, session and page visits, new tabs, close and reopen, etc.
  4. Reset the cookies, and disable single_cookie (in index.slim and rebuild, or in index.html).
  5. Confirm everything still works as expected.
  6. Enable single_cookie.
  7. Confirm the original cookies are erased

@layoutd layoutd self-assigned this Jan 17, 2024
@layoutd layoutd requested a review from a team January 24, 2024 22:16
@layoutd
Copy link
Collaborator Author

layoutd commented Jan 24, 2024

Seems to work well, generally. Includes a timestamp in the session to simulate session expiration (for counting visits, for example).

@layoutd
Copy link
Collaborator Author

layoutd commented Jan 25, 2024

Closing and merging functionality into #3

@layoutd layoutd closed this Jan 25, 2024
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.

1 participant