<?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>311888</bug_id>
          
          <creation_ts>2026-04-09 18:38:48 -0700</creation_ts>
          <short_desc>Digital Credentials: CredentialsContainer::get() skips CredMan-level precondition checks</short_desc>
          <delta_ts>2026-07-13 20:42:54 -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>WebCore Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>
          
          <blocked>268516</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Marcos Caceres">marcosc</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2198615</commentid>
    <comment_count>0</comment_count>
    <who name="Marcos Caceres">marcosc</who>
    <bug_when>2026-04-09 18:38:48 -0700</bug_when>
    <thetext>The Digital Credentials path in CredentialsContainer::get() bypasses several precondition checks that the Credential Management spec&apos;s &quot;Request a Credential&quot; algorithm (§2.5.1) requires before dispatching to [[DiscoverFromExternalSource]].

Gaps:

1. **Mediation conditional check (step 8a)**: The CredMan spec requires rejecting with TypeError when mediation is &quot;conditional&quot; and the credential type doesn&apos;t support it. Digital credentials don&apos;t support conditional mediation, but this wasn&apos;t checked in the CredMan layer.

2. **Permissions Policy check (step 11)**: The Permissions Policy check for `digital-credentials-get` was implemented inside DigitalCredential::discoverFromExternalSource() rather than in CredentialsContainer::get() where the spec requires it.

3. **&quot;Fully active descendant of top-level traversable with user attention&quot; (DC spec step 5)**: The implementation used Document::hasFocus() + visibilityState(), which is MORE restrictive than the spec requires. hasFocus() requires the focused frame to be a descendant of the calling document&apos;s frame, which breaks cross-origin iframes with `allow=&quot;digital-credentials-get&quot;`. The spec&apos;s concept uses isFullyActive() + page-level visibility/focus (system attention on the top-level traversable).

4. **Wrong error code for concurrent requests**: CredentialRequestCoordinator rejected concurrent requests with InvalidStateError, but the CredMan spec requires NotAllowedError.

Fix:
- Add Document::isFullyActiveDescendantOfTopLevelTraversableWithUserAttention() using isFullyActive() + Page::isVisibleAndActive()
- Move Permissions Policy and mediation conditional checks to CredentialsContainer::get()
- Fix error code in CredentialRequestCoordinator from InvalidStateError to NotAllowedError

Branch: eng/credman-dc-security-checks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2201329</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-04-16 18:39:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/174971012&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>