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

Feature: Add the capability of setting "allow list" content policy #376

Merged
merged 50 commits into from
Jan 29, 2024

Conversation

mohdsayed
Copy link
Collaborator

@mohdsayed mohdsayed commented Dec 31, 2023

Description

Add the capability of updating the "allow list" Content Policy setting directly from cookies table in PSAT. This PR will add the following functionality

  • Ability to right-click on a table row and add a domain to the allow-list.
  • The user should then be able to view the allow-listed domains under chrome://settings/content/siteData.
  • A user should be able to distinguish cookies that have been allow-listed by using colors in the row.
  • Ability to remove a domain from the allow-listed settings.
  • The allow list setting should only be available during a browser session.

Relevant Technical Choices

Constraints

  • There seems to be some issue with the content settings API due to which the cookies which are set as session_only are being treated as cookies set to allow. The issue has been reported here. Therefore chrome.storage.session has been used to store allowed list settings which gets erased after a browser session.

Testing Instructions

  1. Go to a website like https://www.bbc.com/ and analyze the cookies.
  2. Right-click on a blocked cookie to open the context menu, and click on "Add domain to allow list".
  3. This will add the domain to the allow list, which can be seen as "Blocked Reason (allow listed)" in the bottom description box. However, the yellow color of the blocked cookie will not change, as the cookie is still blocked (unless we refresh the page).
  4. If the cookie was blocked due to user preference or 3PCD, it will be allowed and the cookie row will turn green. If the cookie is blocked for any other reason, it will remain blocked with a yellow color row.
  5. Once a cookie is added to allowed list, it can also be removed from its context menu as shown in the below screenshot.

Its important to note that if a domain for example .bbc.com is added to allow list, its subdomains like xyz.bbc.com will also be allow listed and if you want to remove it's subdomain from allow list, you would need to remove the parent domain from allow list.

Screenshot/Screencast

image

Checklist

  • I have thoroughly tested this code to the best of my abilities.
  • I have reviewed the code myself before requesting a review.
  • This code is covered by unit tests to verify that it works as intended.
  • The QA of this PR is done by a member of the QA team (to be checked by QA).

Fixes #334

@mohdsayed mohdsayed added the feature Feature/capability of the tool label Dec 31, 2023
@mohdsayed mohdsayed self-assigned this Dec 31, 2023
mohdsayed and others added 24 commits January 9, 2024 20:24
…422)

* Add new key in CookieTableData type

* Pass row context menu as prop and remove useAllowList hook

* Move useAllowedList logic into standalone functions

* Move conext menu into CookieListing and introduce states and callback for modal

* Remove selected row from table

* Stop propagation on click

* ref: Refactor the utils handling clicks, removal of domain, setting domain and parent domain

* perf: clean up unrequired calls

* chore: delete already moved files

* ref: Refactor useEffects

* fix: Update condition for getting domain in allow list

* ref: move row context menu ui and logic to separate component

* ref: move allowed list logic to a hook

* test: add tests for rowContextMenu

* fix: capitalize context menu options

* test: add tests for utils
@mohdsayed mohdsayed marked this pull request as ready for review January 16, 2024 18:00
Copy link
Collaborator

@mayan-000 mayan-000 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mohdsayed mohdsayed merged commit 85112cd into develop Jan 29, 2024
4 checks passed
@mohdsayed mohdsayed deleted the feat/allowed-list branch January 29, 2024 14:23
@mohdsayed mohdsayed mentioned this pull request Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature/capability of the tool
2 participants