<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>298123</bug_id>
          
          <creation_ts>2025-08-29 14:38:47 -0700</creation_ts>
          <short_desc>dNR: dynamic rules apply to extensions</short_desc>
          <delta_ts>2025-08-30 11:56:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Extensions</component>
          <version>Safari 18</version>
          <rep_platform>All</rep_platform>
          <op_sys>iOS 18</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>rhill</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>opendarwin</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2139773</commentid>
    <comment_count>0</comment_count>
      <attachid>476562</attachid>
    <who name="">rhill</who>
    <bug_when>2025-08-29 14:38:47 -0700</bug_when>
    <thetext>Created attachment 476562
Minimal MV3 extension

Steps to reproduce:

Install one or more extensions from the App store. Examples:
- uBlock Origin Lite: https://apps.apple.com/us/app/ublock-origin-lite/id6745342698
- Ghostery: https://apps.apple.com/us/app/ghostery-privacy-ad-blocker/id6504861501

Install the attached minimal extension as temporary extension. It will dynamically add the following DNR rule:

    {
        &quot;id&quot;: 1,
        &quot;action&quot;: { &quot;type&quot;: &quot;block&quot; },
        &quot;condition&quot;: {
            &quot;urlFilter&quot;: &quot;.css&quot;
        }
    }
 
First, visit a simple webpage:
- https://news.ycombinator.com

Result: un-styled content, expected.

Next, open the popup panel of one of the previously installed extension from the App store.

Result: popup panels render with un-style content, possibly unusable as a result.

I tried to reproduce the issue using static ruleset with the same dynamic rule causing issue, and I could not reproduce, so unless I erred in my test, the issue occurs only with dynamic rules.

I stumbled on this issue while trying to investigate an issue on the iPad. uBlock Origin Lite offers the ability to manually enter DNR rules, and upon entering a broadly blocking rule as the one above (which would block all secondary resources, not just `css`), this issue caused the extension to brick itself, and also break all other extensions installed. Since the extension was now virtually bricked, there was no way to remove the offending rules since the user interface would not come up, as the background process was also broken.

Unexpectedly, uninstalling the extension, force closing the browser, shutting down the device, re-opening the browser then re-installing the extension did not solve the issue -- it appears extension storage is not removed when an extension is uninstalled -- this is another issue unveiled while investigating the issue here. The only recourse was to access the background page with dev tools, then manually removing the problematic DNR rule using the console.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2139774</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-08-29 14:38:55 -0700</bug_when>
    <thetext>&lt;rdar://problem/159472185&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2139893</commentid>
    <comment_count>2</comment_count>
    <who name="Jeff Johnson">opendarwin</who>
    <bug_when>2025-08-30 11:56:38 -0700</bug_when>
    <thetext>I can reproduce the issue on macOS.

In my testing, simply disabling the extension in Safari Extension Settings should disable the DNR rule and stop it from breaking everything.

I believe that if you uninstall an extension, Safari does eventually purge the extension&apos;s storage after a period of time, but not right away.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>476562</attachid>
            <date>2025-08-29 14:38:47 -0700</date>
            <delta_ts>2025-08-29 14:38:47 -0700</delta_ts>
            <desc>Minimal MV3 extension</desc>
            <filename>dnr-issue.zip</filename>
            <type>application/zip</type>
            <size>1754</size>
            <attacher>rhill</attacher>
            
              <data encoding="base64">UEsDBBQAAAAAANOKHVsAAAAAAAAAAAAAAAAKACAAZG5yLWlzc3VlL3V4CwABBPUBAAAEFAAAAFVU
DQAHHhqyaB4asmgeGrJoUEsDBBQACAAIANOKHVsAAAAAAAAAAAAAAAAUACAAX19NQUNPU1gvLl9k
bnItaXNzdWV1eAsAAQT1AQAABBQAAABVVA0ABx4asmgeGrJoZhqyaGNgFWNnYGJg8E1MVvAPVohQ
gAKQGAMnEBsBcSEQg/iLGYgCjiEhQVAmSMcMIOZGU8KIEBdNzs/VSywoyEnVKyjKL0vNS8xLTmVg
ZGJgVtdQUtvtrw8AUEsHCB+AZOJWAAAAowAAAFBLAwQUAAgACABsih1bAAAAAAAAAAAAAAAAFwAg
AGRuci1pc3N1ZS9iYWNrZ3JvdW5kLmpzdXgLAAEE9QEAAAQUAAAAVVQNAAdcGbJoJxqyaFwZsmhN
jrEOwjAMRPd+hZUJJFSpa1kREgtD14ohjT1EpE1JnKKqyr+TFCjcdH53ttw5+/TkSiRlpJOsJ7oS
N/QI5LkMI0qm0zzIXqsmGPK7pYAsibjONbQfkiQ0ihqqww9IxdoOCS4geB4pOdEZq+4C4l9N2QH1
t7nhNQrOnLVhcnm1VN6LLY+ri7f3IUe9nSg/dcH8FlSQkrg/FsULUEsHCMSTauuaAAAA5QAAAFBL
AwQUAAgACABsih1bAAAAAAAAAAAAAAAAIgAgAF9fTUFDT1NYL2Ruci1pc3N1ZS8uX2JhY2tncm91
bmQuanN1eAsAAQT1AQAABBQAAABVVA0AB1wZsmgnGrJoZhqyaGNgFWNnYGJg8E1MVvAPVohQgAKQ
GAMnEBsBcSEQg/iLGYgCjiEhQVAmSMcMIOZGU8KIEBdNzs/VSywoyEnVKyjKL0vNS8xLTmVgZGJg
VtdQUtvtrw8AUEsHCB+AZOJWAAAAowAAAFBLAwQUAAgACADTih1bAAAAAAAAAAAAAAAAFwAgAGRu
ci1pc3N1ZS9tYW5pZmVzd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