forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
DNR: Fix regex translation, error handling, and add real-world ruleset tests #1
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
Open
chrmod
wants to merge
33
commits into
main
Choose a base branch
from
ghostery/dnr-bug-reproduction
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a961288
Add tests reproducing DNR translation and compilation issues with rea…
chrmod cba3ff2
Add validate-dnr-rules tool for checking DNR rulesets against WebKit'…
chrmod 66f54b7
Fix spurious "duplicate rule id 0" errors for invalid DNR rules
chrmod e1a26a4
Fix validate-dnr-rules to use locally-built WebKit at runtime
chrmod ef095de
Fix misleading error limit message in DNR rule translator
chrmod 0170c00
Support bounded quantifiers {n}, {n,m}, {n,} in content extension URL…
chrmod b79db5d
Support \d, \w, \s character class shorthands in content extension UR…
chrmod cce6230
Support alternation (|) inside groups in content extension URL filters
chrmod b95de5b
Map DNR "object" resource type to WebKit's "other" content blocker type
chrmod 8fd1255
Support word boundaries (\b, \B) in content extension URL filters
chrmod 49a15c8
Support \b word boundaries, character class shorthands in [...], and …
chrmod fc60bb0
Support {0} quantifier and top-level alternation in URL filters
chrmod 18b0883
Add standalone validate-dnr-rules tool and distribution plans
chrmod a3861ec
Remove planning docs — plans are now implemented
chrmod a172390
Add CMake build and GitHub Actions CI for cross-platform validate-dnr…
chrmod 58393ff
Fix CMake module path and split CI configure per platform
chrmod d3be5fd
Build validate-dnr-rules via WebKit's root CMake with shallow checkout
chrmod ebd31f5
Install full GTK build deps for Linux CI
chrmod beb1f3c
Use WebKit's own install-dependencies script for Linux CI
chrmod 6d2adcc
Fix Linux deps and add CMake build cache
chrmod 1333d4e
Remove unavailable WPE packages from Linux CI
chrmod 50de9b0
Add missing ATSPI and gi-docgen deps for GTK configure
chrmod 7f8a888
Disable optional GTK features to minimize CI dependencies
chrmod 50276e8
Use JSCOnly port for CI — only needs ICU, no GTK/platform deps
chrmod bf168d4
Fix WTF include paths for CMake build
chrmod 6950e27
Fix JavaScriptCore include bridge to point to yarr/ subdirectory
chrmod f226fad
Linux build working: JSCOnly port + system malloc + Gigacage stub
chrmod 7161c47
Add macOS arm64 build to CI, fix bmalloc stubs for cross-platform
chrmod 78c3345
Use macos-15 runner for newer Clang with asm constraint support
chrmod ca61383
Create GitHub Release with binaries on merge to ghostery branch
chrmod 8df9c11
Also trigger on ghostery/* branches for testing
chrmod 151dbe4
Use 'validator' as the release branch name
chrmod 473b77c
Ad-hoc codesign macOS binary for Apple Silicon Gatekeeper
chrmod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| name: Build validate-dnr-rules | ||
|
|
||
| on: | ||
| push: | ||
| branches: [validator, ghostery/*] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| name: linux-x64 | ||
| deps: cmake ninja-build pkg-config ruby unifdef libicu-dev g++ perl python3 | ||
| - os: macos-15 | ||
| name: macos-arm64 | ||
| deps: cmake ninja icu4c pkg-config | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Install dependencies (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends ${{ matrix.deps }} | ||
|
|
||
| - name: Install dependencies (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: brew install ${{ matrix.deps }} | ||
|
|
||
| - name: Cache CMake build | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: build | ||
| key: cmake-${{ matrix.name }}-${{ hashFiles('Source/WTF/**', 'Source/WebCore/contentextensions/**', 'ghostery/validate-dnr-rules/**') }} | ||
| restore-keys: | | ||
| cmake-${{ matrix.name }}- | ||
|
|
||
| - name: Configure | ||
| run: | | ||
| cmake -B build -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DPORT=JSCOnly \ | ||
| -DUSE_SYSTEM_MALLOC=ON \ | ||
| . | ||
| env: | ||
| CMAKE_PREFIX_PATH: ${{ runner.os == 'macOS' && '/opt/homebrew/opt/icu4c' || '' }} | ||
|
|
||
| - name: Build | ||
| run: cmake --build build --target validate-dnr-rules | ||
|
|
||
| - name: Test | ||
| run: | | ||
| cat > /tmp/test-rules.json << 'RULES' | ||
| [ | ||
| {"id":1,"priority":1,"action":{"type":"block"},"condition":{"regexFilter":"ad[0-9]{2}\\.js"}}, | ||
| {"id":2,"priority":1,"action":{"type":"block"},"condition":{"regexFilter":"(?:ads|tracking)\\.com"}}, | ||
| {"id":3,"priority":1,"action":{"type":"block"},"condition":{"regexFilter":"tracker\\d+\\.js"}}, | ||
| {"id":4,"priority":1,"action":{"type":"block"},"condition":{"regexFilter":"pixel\\b"}} | ||
| ] | ||
| RULES | ||
| ./build/bin/validate-dnr-rules /tmp/test-rules.json | ||
|
|
||
| - name: Sign binary (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: codesign --sign - --force build/bin/validate-dnr-rules | ||
|
|
||
| - name: Prepare artifact | ||
| run: | | ||
| cp build/bin/validate-dnr-rules validate-dnr-rules-${{ matrix.name }} | ||
| chmod +x validate-dnr-rules-${{ matrix.name }} | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: validate-dnr-rules-${{ matrix.name }} | ||
| path: validate-dnr-rules-${{ matrix.name }} | ||
|
|
||
| release: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
|
|
||
| - name: Create release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GH_REPO: ${{ github.repository }} | ||
| run: | | ||
| TAG="validate-dnr-rules-$(date +%Y%m%d)-${GITHUB_SHA::8}" | ||
|
|
||
| # Delete existing release with same tag if re-running | ||
| gh release delete "$TAG" --yes 2>/dev/null || true | ||
|
|
||
| gh release create "$TAG" \ | ||
| --title "validate-dnr-rules $(date +%Y-%m-%d)" \ | ||
| --notes "Automated build from commit ${GITHUB_SHA::8}. | ||
|
|
||
| ## Downloads | ||
| - **Linux x64**: \`validate-dnr-rules-linux-x64\` | ||
| - **macOS arm64**: \`validate-dnr-rules-macos-arm64\` (Intel Macs: run via Rosetta) | ||
|
|
||
| ## Usage | ||
| \`\`\` | ||
| chmod +x validate-dnr-rules-* | ||
| ./validate-dnr-rules-linux-x64 path/to/dnr-rules.json | ||
| \`\`\`" \ | ||
| artifacts/validate-dnr-rules-linux-x64/validate-dnr-rules-linux-x64 \ | ||
| artifacts/validate-dnr-rules-macos-arm64/validate-dnr-rules-macos-arm64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes no sense (overloading on cost and returning iterators to different vectors).
This is almost certainly a bug.