<?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>257176</bug_id>
          
          <creation_ts>2023-05-22 19:06:12 -0700</creation_ts>
          <short_desc>WebAuthn .create() rejects with &quot;NotAllowedError: Operation Failed&quot; after conditional UI request aborted</short_desc>
          <delta_ts>2024-03-19 11:20:45 -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 Misc.</component>
          <version>Safari 16</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 13</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          
          <blocked>271257</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Matthew Miller (Cisco)">matthew</reporter>
          <assigned_to name="Abigail F">abifox</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>pascoe</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1957199</commentid>
    <comment_count>0</comment_count>
    <who name="Matthew Miller (Cisco)">matthew</who>
    <bug_when>2023-05-22 19:06:12 -0700</bug_when>
    <thetext>## Context

I&apos;m observing Safari rejecting a call to `navigator.credentials.create()` with &quot;NotAllowedError: Operation Failed&quot; when the active page has an active conditional UI request.

## Environment

- macOS 13.4
- Safari 16.5

## Reproduction Steps

1. Host the following HTML file on http://localhost (see the end of this description)
2. Observe conditional UI is active on the lone text input
3. Open Safari dev tools
4. Click the &quot;Start modal registration&quot; button
5. Observe the expected &quot;AbortError: Aborted by AbortSignal&quot; error
6. After a short delay, observe the unexpected &quot;NotAllowedError: Operation failed&quot; error and no WebAuthn registration modal
7. Refresh the page
8. Click the &quot;Start modal authentication&quot; button
9. Observe the expected &quot;AbortError: Aborted by AbortSignal&quot; error
10. Observe the typical Safari WebAuthn authentication modal

### Sample code

```html
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot; /&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot; /&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;
    &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;button id=&quot;startReg&quot;&gt;Start modal registration&lt;/button&gt;
    &lt;button id=&quot;startAuth&quot;&gt;Start modal authentication&lt;/button&gt;
    &lt;form action=&quot;&quot;&gt;
      &lt;input
        type=&quot;email&quot;
        name=&quot;email&quot;
        id=&quot;email&quot;
        autocomplete=&quot;webauthn username&quot;
      /&gt;
    &lt;/form&gt;
    &lt;script&gt;
      const abortController = new AbortController();

      // 1. Start conditional UI
      navigator.credentials
        .get({
          publicKey: {
            challenge: new Uint8Array(16).fill(0),
            allowCredentials: [],
          },
          mediation: &quot;conditional&quot;,
          signal: abortController.signal,
        })
        .then(console.log)
        .catch(console.error);

      // 2. Click to start modal registration (errors out with &quot;NotAllowedError: Operation Failed&quot;)
      document.getElementById(&quot;startReg&quot;).addEventListener(&quot;click&quot;, () =&gt; {
        abortController.abort(
          new Error(&quot;cancelling conditional UI for registration&quot;)
        );
        navigator.credentials.create({
          publicKey: {
            challenge: new Uint8Array(16).fill(0),
            rp: { id: &quot;localhost&quot;, name: &quot;localhost&quot; },
            user: {
              id: new Uint8Array(16).fill(0),
              name: &quot;Username&quot;,
              displayName: &quot;Username&quot;,
            },
            pubKeyCredParams: [{ alg: -7, type: &quot;public-key&quot; }],
          },
        });
      });

      // 3. Click to start modal authentication (it works as expected)
      document.getElementById(&quot;startAuth&quot;).addEventListener(&quot;click&quot;, () =&gt; {
        abortController.abort(
          new Error(&quot;cancelling conditional UI for authentication&quot;)
        );
        navigator.credentials.get({
          publicKey: {
            challenge: new Uint8Array(16).fill(0),
          },
        });
      });
    &lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;
```

## Expected Behavior

I was expecting the conditional UI request to reject with the AbortError, and then Safari to show the typical registration modal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1958467</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-05-27 18:37:34 -0700</bug_when>
    <thetext>&lt;rdar://problem/109936742&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2006171</commentid>
    <comment_count>2</comment_count>
    <who name="Abigail F">abifox</who>
    <bug_when>2024-01-19 10:49:26 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/22983</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2009778</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-02-01 09:35:05 -0800</bug_when>
    <thetext>Committed 273918@main (ded025f42cde): &lt;https://commits.webkit.org/273918@main&gt;

Reviewed commits have been landed. Closing PR #22983 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>