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

Reuse procedural_filters.ts for ios #25694

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

atuchin-m
Copy link
Collaborator

@atuchin-m atuchin-m commented Sep 23, 2024

  • Shares procedural filtering javascript from core (desktop/android) with iOS.
  • Moves SelectorsPollerScript.js from brave-ios into brave-core (renamed to content_cosmetic_ios.js).

Resolves brave/brave-browser#43262

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Re-using testcase from procedural filtering PR (except testcase 29 brave/brave-browser#40771).

  1. In Settings -> Shields & Privacy -> Content Filtering, subscribe to https://antonok.com/tmp/procedural-filter-tests/test-extended-css-rules.txt.
  2. Visit https://antonok.com/tmp/procedural-filter-tests/index.html
  3. All of the following numbered test cases should pass:
  • 1
  • 2
  • 3
  • 6
  • 7
  • 8
  • 9
  • 20
  • 21
  • 24
  • 26
  • 28

@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Sep 23, 2024
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@StephenHeaps StephenHeaps force-pushed the adblock-consmetic-filter-ios-ts branch from 6e39d70 to 7a28277 Compare September 23, 2024 15:49
@kylehickinson kylehickinson force-pushed the adblock-consmetic-filter-ios-ts branch from 7a28277 to 032dbe9 Compare September 24, 2024 10:39
@atuchin-m atuchin-m changed the title Add stub cosmetic_filters_core.ts Reuse procedural_filters.ts for ios Sep 24, 2024
@atuchin-m atuchin-m marked this pull request as ready for review September 24, 2024 15:40
@atuchin-m atuchin-m requested a review from a team as a code owner September 24, 2024 15:40
@StephenHeaps StephenHeaps mentioned this pull request Oct 22, 2024
24 tasks
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@StephenHeaps StephenHeaps force-pushed the adblock-consmetic-filter-ios-ts branch from 4d6dcb6 to 3d3f0be Compare January 10, 2025 15:30
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@StephenHeaps StephenHeaps force-pushed the adblock-consmetic-filter-ios-ts branch from 3d3f0be to 3729ad3 Compare January 13, 2025 03:32
@StephenHeaps
Copy link
Collaborator

SonarCloud flags a security hotspot for using Math.random() in components/cosmetic_filters/resources/data/content_cosmetic_ios.js (this file was just renamed, slightly updated for presubmit / changes to share procedural filtering javascript). We use this the same as desktop, best described by @antonok-edm here:

SonarCloud flags this Math.random() as insecure for cryptography purposes.

It's only used here to generate ephemeral CSS classes.

If a page is able to predict this random generator, the only risk is that it may be able to detect and/or revert stylesheet changes made by Brave Shields. There are much easier ways to do that than randomness side-channel analysis, and either way we'd address cases like that with a filter list update.

#24688 (comment)

cc @stoletheminerals

@stoletheminerals
Copy link
Contributor

Thanks for pinging @StephenHeaps, yeah that sonarcloud alert can be ignored

@StephenHeaps StephenHeaps force-pushed the adblock-consmetic-filter-ios-ts branch from 64eafe6 to fe5b608 Compare January 13, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build puLL-Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Share Procedural Filtering javascript across platforms
5 participants