<?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>237281</bug_id>
          
          <creation_ts>2022-02-28 10:55:49 -0800</creation_ts>
          <short_desc>Sandbox CSP directives allows websites to block execution of browser features implemented in JavaScript</short_desc>
          <delta_ts>2023-01-08 15:19:49 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=192753</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=178040</see_also>
          <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 name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>anhvy2013</cc>
    
    <cc>bfulgham</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>pgriffis</cc>
    
    <cc>simonepas</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1846703</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-02-28 10:55:49 -0800</bug_when>
    <thetext>It seems web content is able to prevent the application from executing JavaScript using APIs like webkit_web_view_run_javascript() by using the &quot;sandbox&quot; CSP directive, see https://gitlab.gnome.org/GNOME/epiphany/-/issues/1698.

Needless to say, this CSP directive should only block *web content* from executing JS. It shouldn&apos;t block the browser itself from executing its own JS. Currently the web content is able to disable browser features, e.g. Epiphany&apos;s security warning when focusing an insecure password form, Epiphany&apos;s warning before closing a web page with an unsubmitted form, Epiphany&apos;s entire password manager, and even things like the code to compute a web app&apos;s name and title when creating a new web app. JS is used for a lot of stuff and it has to work.

See also: bug #192753.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1848829</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-03-07 10:56:16 -0800</bug_when>
    <thetext>&lt;rdar://problem/89917757&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1853490</commentid>
    <comment_count>2</comment_count>
    <who name="John Wilander">wilander</who>
    <bug_when>2022-03-21 20:18:10 -0700</bug_when>
    <thetext>Thanks for filing! I don&apos;t know if you are writing patches for WebKit these days, Michael. If so, is this something you intend/want to work on?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1853640</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-03-22 07:05:26 -0700</bug_when>
    <thetext>I looked at it briefly, but not closely enough to prepare a patch. The error is coming from ScriptController::executeScriptInWorld, which decides scripts are not allowed because ScriptController::canExecuteScripts returns false. Maybe we need a new ReasonForCallingCanExecuteScripts for scripts executed by WebKit API that bypass some of the checks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1880374</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-07-02 09:11:04 -0700</bug_when>
    <thetext>Somebody is complaining on Matrix that this also breaks WebKit&apos;s HTMLMediaElement controls. So it&apos;s not just browser-level features, but also WebKit features that are affected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1880375</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2022-07-02 09:12:57 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #4)
&gt; Somebody is complaining on Matrix that this also breaks WebKit&apos;s
&gt; HTMLMediaElement controls. So it&apos;s not just browser-level features, but also
&gt; WebKit features that are affected.

And it means the strategy suggested in my comment #3 would be insufficient to fully fix this. We&apos;d need to identify other places within WebKit that use internal JavaScript and fix those too. I&apos;m not sure what else there would be besides media controls, but I bet there&apos;s more I don&apos;t know about....</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>