<?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>281149</bug_id>
          
          <creation_ts>2024-10-09 10:06:31 -0700</creation_ts>
          <short_desc>WebKit is inconsistent about whether localhost is a secure origin or not</short_desc>
          <delta_ts>2026-04-20 13:41:10 -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>Page Loading</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>REOPENED</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=171934</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=218980</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=232088</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="Sam Sneddon [:gsnedders]">gsnedders</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>adomas.ven</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>beidson</cc>
    
    <cc>jonkoops</cc>
    
    <cc>me</cc>
    
    <cc>m_finkel</cc>
    
    <cc>rik</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2066570</commentid>
    <comment_count>0</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2024-10-09 10:06:31 -0700</bug_when>
    <thetext>We have a number of open bugs about localhost and whether or not it is secure: bug 171934 (Don&apos;t treat loopback addresses (127.0.0.0/8, ::1/128, localhost, .localhost) as mixed content), bug 218980 (Treat loopback addresses (127.0.0.0/8, ::1/128, localhost, .localhost) as potentially trustworthy URL), and bug 232088 (Unable to set secure+httpOnly cookie for localhost in Safari from Node JS).

As it stands, window.isSecureOrigin is true, but you can&apos;t set secure cookies, and nor load mixed secure content.

For example:

https://github.com/WebKit/WebKit/blob/b50ab39c922f4afcc0b894736c29846f1f50d065/Source/WebCore/page/SecurityOrigin.cpp#L89-L105 makes localhost &quot;potentially trustworthy&quot;

https://github.com/WebKit/WebKit/blob/f5955e181acaa5aacc1c6c573a92697d661d6926/Source/WebCore/loader/MixedContentChecker.cpp#L51-L60 makes localhost insecure (unless loaded over HTTPS)

https://github.com/WebKit/WebKit/blob/f5955e181acaa5aacc1c6c573a92697d661d6926/Source/WebCore/loader/CookieJar.cpp#L62-L65 makes Secure cookies only work with HTTPS.

Regardless of whether we want localhost to be secure or not (which I think is to some extent blocked on bug 250607?), we should at least be consistent as to whether or not it is secure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2066571</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-10-09 10:06:44 -0700</bug_when>
    <thetext>&lt;rdar://problem/137604100&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2193562</commentid>
    <comment_count>2</comment_count>
    <who name="Xyan">x_bhatnagar</who>
    <bug_when>2026-03-25 10:53:20 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/61338</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2196735</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-04-03 16:16:51 -0700</bug_when>
    <thetext>Committed 310542@main (aa297f89b9a6): &lt;https://commits.webkit.org/310542@main&gt;

Reviewed commits have been landed. Closing PR #61338 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202376</commentid>
    <comment_count>4</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2026-04-20 13:41:10 -0700</bug_when>
    <thetext>&lt;rdar://175191283&gt;

https://commits.webkit.org/310542@main looks like it addressed bug 232088, as the summary line is &quot;Add support for Secure cookies for loopback hostnames&quot;.

But: that doesn&apos;t actually solve the inconsistency, as with bug 171934 and bug 218980 still unresolved we still have places where we do treat it as insecure.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>