Skip to content

ios: adblock: skip rules that do not block by domain#5658

Open
pronebird wants to merge 1 commit into
developfrom
am/adblock-ignore-non-anchor-rules
Open

ios: adblock: skip rules that do not block by domain#5658
pronebird wants to merge 1 commit into
developfrom
am/adblock-ignore-non-anchor-rules

Conversation

@pronebird

@pronebird pronebird commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR improves blocking rules handling by filtering out all rules that do not target domains or other kinds of rules (e.g regex, exceptions, etc..)

Checklist:

  • Changelog

Screenshots (optional, if UI related)


This change is Reviewable

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved adblocker behavior on iOS by skipping ad-blocking rules that don’t include domain-based blocking, reducing cases where ads were not filtered as expected.
    • Refined domain filtering so only hostname-anchored rules are used for domain matching, improving accuracy and precision.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b3f11f0e-5ecf-4d38-a088-6e03053d551b

📥 Commits

Reviewing files that changed from the base of the PR and between 4908970 and 873a891.

📒 Files selected for processing (2)
  • nym-vpn-core/CHANGELOG.md
  • nym-vpn-core/crates/nym-vpn-lib/src/adblocker/engines/simple.rs
✅ Files skipped from review due to trivial changes (1)
  • nym-vpn-core/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • nym-vpn-core/crates/nym-vpn-lib/src/adblocker/engines/simple.rs

📝 Walkthrough

Walkthrough

The adblock rule parsing pipeline in populate_db is refactored to use stepwise early returns and restrict domain collection to hostname-anchored rules only. Import statements are reorganized to add NetworkFilterMaskHelper. The fix is documented in the CHANGELOG for iOS.

Changes

Adblocker hostname-anchor filtering refinement

Layer / File(s) Summary
Import grouping and hostname-anchor parse gate
nym-vpn-core/crates/nym-vpn-lib/src/adblocker/engines/simple.rs
NetworkFilterMaskHelper is added to the grouped adblock imports. populate_db line parsing is rewritten with stepwise early Ok(None) returns for non-network parses and missing hostnames; domain collection is restricted to rules where filter.is_hostname_anchor() returns true.
Changelog entry for iOS ad-blocking fix
nym-vpn-core/CHANGELOG.md
Documents the iOS fix under [Unreleased] to skip ad-blocking rules that do not block by domain.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • neacsu
  • trojanfoe

Poem

🐇 Hop, hop through each filter line,
Early return when rules don't align,
Only hostname anchors may pass,
The domain list grows, unsurpassed—
A cleaner parse, a tidier den! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description lacks required information: no JIRA ticket reference (JIRA-NYM-XXXX) is provided, which is a required section in the template. Add the missing JIRA ticket reference in the Ticket section to fully comply with the repository's PR description template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: skipping iOS adblock rules that do not block by domain, which aligns with the core refactoring in simple.rs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch am/adblock-ignore-non-anchor-rules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot requested a review from neacsu June 22, 2026 16:42
@pronebird pronebird force-pushed the am/adblock-ignore-non-anchor-rules branch from 4908970 to 873a891 Compare June 22, 2026 16:42
@github-actions github-actions Bot requested a review from trojanfoe June 22, 2026 16:42
@sonarqubecloud

Copy link
Copy Markdown

@pronebird pronebird requested a review from agentpietrucha June 22, 2026 17:04
@pronebird pronebird added this to the v2026.12 - Vanil Noir milestone Jun 22, 2026
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