SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
Investigation into DNR regexFilter
Byungwoo Lee
October 18th, 2023
Igalia, collaborates with content filtering
● Added :has() pseudo class
○ Enables content filtering extensions to remove their own implementation for better
support of :has() in the filter list: (e.g. target.com##.target:has(.malicious))
● Added declarativeNetRequest.updateStaticRules() extension API
○ Allows content filtering extensions to selectively disable or enable individual static rules.
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Igalia, collaborates with content filtering
● Investigating other issues:
○ Injecting scripts to initial about:blank document by using
contentScripts extension API
○ Improving regular expression support in declarativeNetRequest
extension API
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
regexFilter in declarativeNetRequest
● “Regular expression to match against the network request url. This follows the RE2 syntax.”
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
{
"id": 1,
"priority": 1,
"action": { "type": "block" },
"condition": {
"regexFilter": "^https://(malicious1|malicious2).com/[0-9a-f]{12}.js",
"resourceTypes": [ "script" ]
}
}
Ref. https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#property-RuleCondition-regexFilter
Issue 1: Regex Syntax differences
● Regex syntax differences between the Javascript and RE2:
○ RE2 regex syntax supports all Javascript regex syntax except followings:
■ Supported functionality in different syntax
● Matches the character with the unicode value (u{hhhh} -> x{hhhh})
● Named capturing group ((?<Name>x) -> (?P<Name>x))
■ Unsupported functionality
● Matches a backspace([b]), NUL(/0), control character(cX), UTF-16 code-unit(uhhhh).
● lookahead assertion(x(?=y)), negative lookahead assertion((x(?!y)),
lookbehind assertion(x(?<=y)), negative lookahead assertion(x(?<!y))
● back reference(n where ‘n’ is a positive integer), named back reference(k<Name>)
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Issue 2 : Memory limitations with regex filters
● 2 Mb memory limit for each rule source (dynamic/session/static)
○ maximum 2 Kb memory limit for each RE2 instance (for each regex filter)
○ maximum 1000 regex filters for each rule source (dynamic/session/static)
● Due to the 2 Kb memory limit for each regex filter, some regex filters that were
valid in Manifest v2 are now invalid in Manifest v3:
(w3c/webextensions/issues/344#issuecomment-1429271719)
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Issue 2 : Memory limitations with regex filters
● The limitation policy is linked to how the RE2 library allocates the given
memory budget.
○ RE2 only allows setting the maximum memory budget when creating a RE2 instance.
○ The RE2 instance uses the entire budget, allocating necessary memory and reserving
the rest for later use.
○ Unfortunately, RE2 lacks a functionality to set the minimum available memory
budget for a regex pattern.
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Ref. https://github.com/google/re2/blob/main/re2/re2.h#L631
Exploring RE2: Memory budget allocation
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Exploring RE2: Optimal allocation case
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Exploring RE2: Understanding memory exceeding error
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Possible solution: Add memory budget adjustment step
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
POC: Prepare patches for RE2 and Chromium projects
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
● RE2: Add ‘minimize_mem_budget’ RE2 creation option.
(https://github.com/byung-woo/re2/pull/4/files)
● Chromium: Optimize memory budget for regex filters.
(https://crrev.com/c/4861562)
POC: Results look promising
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
(Collected regex patterns from abp-filters, AdguardTeam, uBlock, easylist github and other sources)
POC: Challenges in the approach
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
● Challenges in the patches:
○ RE2: Introducing a new RE2 creation option
○ Chromium: Updating a flatbuffer scheme
● Not easy to explain the precise conditions for exceeding the 2Mb per-rule-source
limit.
○ “At some point, if the sum of the memory budget of all filters exceeds 2Mb memory
limit, some of your filters may not loaded.”
Considering sharing progress and seeking feedback
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
● We are considering sharing progress in W3C Web Extensions WG issue:
https://github.com/w3c/webextensions/issues/344
Thank you!
Investigation into DNR regexFilter
Byungwoo Lee, October 18th 2023
Investigation into DNR regexFilter

Weitere ähnliche Inhalte

Ähnlich wie Investigation into DNR regexFilter

The Magic of Text Summarization using Deep Networks
The Magic of Text Summarization using Deep NetworksThe Magic of Text Summarization using Deep Networks
The Magic of Text Summarization using Deep NetworksSK Reddy
 
VictoriaLogs: Open Source Log Management System - Preview
VictoriaLogs: Open Source Log Management System - PreviewVictoriaLogs: Open Source Log Management System - Preview
VictoriaLogs: Open Source Log Management System - PreviewVictoriaMetrics
 
Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?DoKC
 
Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?DoKC
 
sDDS: An Adaptable DDS Solution for Wireless Sensor Networks
sDDS: An Adaptable DDS Solution for Wireless Sensor NetworkssDDS: An Adaptable DDS Solution for Wireless Sensor Networks
sDDS: An Adaptable DDS Solution for Wireless Sensor NetworksReal-Time Innovations (RTI)
 
Python by Martin Geisler
Python by Martin GeislerPython by Martin Geisler
Python by Martin GeislerAberla
 
Research Papers Recommender based on Digital Repositories Metadata
Research Papers Recommender based on Digital Repositories MetadataResearch Papers Recommender based on Digital Repositories Metadata
Research Papers Recommender based on Digital Repositories MetadataRicard de la Vega
 
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2Antonios Giannopoulos
 
Bomb Squad: Containing the Cardinality Explosion - PromCon 2018 Munich
Bomb Squad: Containing the Cardinality Explosion - PromCon 2018 MunichBomb Squad: Containing the Cardinality Explosion - PromCon 2018 Munich
Bomb Squad: Containing the Cardinality Explosion - PromCon 2018 MunichCody Boggs
 
msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...
msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...
msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...digitalwave
 
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...pgdayrussia
 
K8s network policy bypass
K8s network policy bypassK8s network policy bypass
K8s network policy bypassKaizhe Huang
 
Linking Metrics to Logs using Loki
Linking Metrics to Logs using LokiLinking Metrics to Logs using Loki
Linking Metrics to Logs using LokiKnoldus Inc.
 
Linking Metrics to Logs using Loki
Linking Metrics to Logs using LokiLinking Metrics to Logs using Loki
Linking Metrics to Logs using LokiKnoldus Inc.
 
Chapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdfChapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdfRick Hwang
 
LINEデリマでのElasticsearchの運用と監視の話
LINEデリマでのElasticsearchの運用と監視の話LINEデリマでのElasticsearchの運用と監視の話
LINEデリマでのElasticsearchの運用と監視の話LINE Corporation
 
a look at the postgresql engine
a look at the postgresql enginea look at the postgresql engine
a look at the postgresql engineFederico Campoli
 
From shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practicesFrom shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practicesAnkush Chadha, MBA, MS
 
FAIR Projector Builder
FAIR Projector BuilderFAIR Projector Builder
FAIR Projector BuilderMark Wilkinson
 

Ähnlich wie Investigation into DNR regexFilter (20)

The Magic of Text Summarization using Deep Networks
The Magic of Text Summarization using Deep NetworksThe Magic of Text Summarization using Deep Networks
The Magic of Text Summarization using Deep Networks
 
VictoriaLogs: Open Source Log Management System - Preview
VictoriaLogs: Open Source Log Management System - PreviewVictoriaLogs: Open Source Log Management System - Preview
VictoriaLogs: Open Source Log Management System - Preview
 
Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?
 
Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?Why run Postgres in Kubernetes?
Why run Postgres in Kubernetes?
 
sDDS: An Adaptable DDS Solution for Wireless Sensor Networks
sDDS: An Adaptable DDS Solution for Wireless Sensor NetworkssDDS: An Adaptable DDS Solution for Wireless Sensor Networks
sDDS: An Adaptable DDS Solution for Wireless Sensor Networks
 
Python by Martin Geisler
Python by Martin GeislerPython by Martin Geisler
Python by Martin Geisler
 
Research Papers Recommender based on Digital Repositories Metadata
Research Papers Recommender based on Digital Repositories MetadataResearch Papers Recommender based on Digital Repositories Metadata
Research Papers Recommender based on Digital Repositories Metadata
 
Nzitf Velociraptor Workshop
Nzitf Velociraptor WorkshopNzitf Velociraptor Workshop
Nzitf Velociraptor Workshop
 
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
 
Bomb Squad: Containing the Cardinality Explosion - PromCon 2018 Munich
Bomb Squad: Containing the Cardinality Explosion - PromCon 2018 MunichBomb Squad: Containing the Cardinality Explosion - PromCon 2018 Munich
Bomb Squad: Containing the Cardinality Explosion - PromCon 2018 Munich
 
msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...
msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...
msc_pyparser - ModSecurity config parser presentation @CRS Community Summit i...
 
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
PG Day'14 Russia, GIN — Stronger than ever in 9.4 and further, Александр Коро...
 
K8s network policy bypass
K8s network policy bypassK8s network policy bypass
K8s network policy bypass
 
Linking Metrics to Logs using Loki
Linking Metrics to Logs using LokiLinking Metrics to Logs using Loki
Linking Metrics to Logs using Loki
 
Linking Metrics to Logs using Loki
Linking Metrics to Logs using LokiLinking Metrics to Logs using Loki
Linking Metrics to Logs using Loki
 
Chapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdfChapter 8. Partial updates and retrievals.pdf
Chapter 8. Partial updates and retrievals.pdf
 
LINEデリマでのElasticsearchの運用と監視の話
LINEデリマでのElasticsearchの運用と監視の話LINEデリマでのElasticsearchの運用と監視の話
LINEデリマでのElasticsearchの運用と監視の話
 
a look at the postgresql engine
a look at the postgresql enginea look at the postgresql engine
a look at the postgresql engine
 
From shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practicesFrom shipping rpms to helm charts - Lessons learned and best practices
From shipping rpms to helm charts - Lessons learned and best practices
 
FAIR Projector Builder
FAIR Projector BuilderFAIR Projector Builder
FAIR Projector Builder
 

Mehr von Igalia

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEIgalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesIgalia
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceIgalia
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfIgalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!Igalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 

Mehr von Igalia (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 

Kürzlich hochgeladen

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Kürzlich hochgeladen (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

Investigation into DNR regexFilter

  • 1. Investigation into DNR regexFilter Byungwoo Lee October 18th, 2023
  • 2. Igalia, collaborates with content filtering ● Added :has() pseudo class ○ Enables content filtering extensions to remove their own implementation for better support of :has() in the filter list: (e.g. target.com##.target:has(.malicious)) ● Added declarativeNetRequest.updateStaticRules() extension API ○ Allows content filtering extensions to selectively disable or enable individual static rules. Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 3. Igalia, collaborates with content filtering ● Investigating other issues: ○ Injecting scripts to initial about:blank document by using contentScripts extension API ○ Improving regular expression support in declarativeNetRequest extension API Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 4. regexFilter in declarativeNetRequest ● “Regular expression to match against the network request url. This follows the RE2 syntax.” Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023 { "id": 1, "priority": 1, "action": { "type": "block" }, "condition": { "regexFilter": "^https://(malicious1|malicious2).com/[0-9a-f]{12}.js", "resourceTypes": [ "script" ] } } Ref. https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#property-RuleCondition-regexFilter
  • 5. Issue 1: Regex Syntax differences ● Regex syntax differences between the Javascript and RE2: ○ RE2 regex syntax supports all Javascript regex syntax except followings: ■ Supported functionality in different syntax ● Matches the character with the unicode value (u{hhhh} -> x{hhhh}) ● Named capturing group ((?<Name>x) -> (?P<Name>x)) ■ Unsupported functionality ● Matches a backspace([b]), NUL(/0), control character(cX), UTF-16 code-unit(uhhhh). ● lookahead assertion(x(?=y)), negative lookahead assertion((x(?!y)), lookbehind assertion(x(?<=y)), negative lookahead assertion(x(?<!y)) ● back reference(n where ‘n’ is a positive integer), named back reference(k<Name>) Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 6. Issue 2 : Memory limitations with regex filters ● 2 Mb memory limit for each rule source (dynamic/session/static) ○ maximum 2 Kb memory limit for each RE2 instance (for each regex filter) ○ maximum 1000 regex filters for each rule source (dynamic/session/static) ● Due to the 2 Kb memory limit for each regex filter, some regex filters that were valid in Manifest v2 are now invalid in Manifest v3: (w3c/webextensions/issues/344#issuecomment-1429271719) Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 7. Issue 2 : Memory limitations with regex filters ● The limitation policy is linked to how the RE2 library allocates the given memory budget. ○ RE2 only allows setting the maximum memory budget when creating a RE2 instance. ○ The RE2 instance uses the entire budget, allocating necessary memory and reserving the rest for later use. ○ Unfortunately, RE2 lacks a functionality to set the minimum available memory budget for a regex pattern. Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023 Ref. https://github.com/google/re2/blob/main/re2/re2.h#L631
  • 8. Exploring RE2: Memory budget allocation Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 9. Exploring RE2: Optimal allocation case Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 10. Exploring RE2: Understanding memory exceeding error Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 11. Possible solution: Add memory budget adjustment step Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023
  • 12. POC: Prepare patches for RE2 and Chromium projects Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023 ● RE2: Add ‘minimize_mem_budget’ RE2 creation option. (https://github.com/byung-woo/re2/pull/4/files) ● Chromium: Optimize memory budget for regex filters. (https://crrev.com/c/4861562)
  • 13. POC: Results look promising Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023 (Collected regex patterns from abp-filters, AdguardTeam, uBlock, easylist github and other sources)
  • 14. POC: Challenges in the approach Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023 ● Challenges in the patches: ○ RE2: Introducing a new RE2 creation option ○ Chromium: Updating a flatbuffer scheme ● Not easy to explain the precise conditions for exceeding the 2Mb per-rule-source limit. ○ “At some point, if the sum of the memory budget of all filters exceeds 2Mb memory limit, some of your filters may not loaded.”
  • 15. Considering sharing progress and seeking feedback Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023 ● We are considering sharing progress in W3C Web Extensions WG issue: https://github.com/w3c/webextensions/issues/344
  • 16. Thank you! Investigation into DNR regexFilter Byungwoo Lee, October 18th 2023