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

Support modifying cookies #1384

Merged
merged 4 commits into from
Jan 14, 2025
Merged

Support modifying cookies #1384

merged 4 commits into from
Jan 14, 2025

Conversation

jonathanKingston
Copy link
Contributor

Asana Task/Github Issue: https://app.asana.com/0/1206777341262243/1209124294701647/f

Description

Support deletion of cookies for use in breakage situations.

Testing Steps

  • Visit privacy-test-pages.site
  • Set document.cookie="keyToBeDeleted=1" in the console
  • Copy the example modify-cookies.json config test file into the browser (jsonblob or similar).
  • Reload the page, check the cookie has gone.

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

@jonathanKingston jonathanKingston requested a review from a team as a code owner January 10, 2025 15:13
Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for content-scope-scripts failed.

Name Link
🔨 Latest commit 17c1a67
🔍 Latest deploy log https://app.netlify.com/sites/content-scope-scripts/deploys/678699434bf8750009715bd8

Copy link

github-actions bot commented Jan 10, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

Copy link

github-actions bot commented Jan 10, 2025

[Beta] Generated file diff

Time updated: Tue, 14 Jan 2025 17:06:05 GMT

Android
    - android/contentScope.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Apple
    - dist/contentScope.js

File has changed

return [
{ name: 'specified cookie entry deleted', result: specifiedKey, expected: false },
{ name: 'specified cookie entry that is not present on page load', result: nonexistentKey, expected: false },
{ name: 'other cookie entry untouched', result: otherKey, expected: true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test that confirms path is working as expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test to check both states with path. I'd rather not add a second sub path test to validate some of the other cases (I don't think we need to validate the visibility of the cookie for example, because the behavior of cookie is path not set when deleting won't delete).

The same is true for domain but that's a bit more problematic as we intend to run these in a few places.

dharb
dharb previously approved these changes Jan 13, 2025
Copy link
Contributor

@dharb dharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, everything seems to be working as expected. Left a couple comments here and one on the corresponding config PR.

Copy link
Contributor

@dharb dharb 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 adding the test, LGTM 👍

@jonathanKingston jonathanKingston merged commit 399ce49 into main Jan 14, 2025
9 of 13 checks passed
@jonathanKingston jonathanKingston deleted the jkt/modifyCookies branch January 14, 2025 17:23
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.

2 participants