Skip to content

Commit 6ad374d

Browse files
committed
Add Permissions Policy integration with "allowed to use" check
Resolves issue #37 by adding proper Permissions Policy integration to the Local Network Access check algorithm. Changes: - Replace TODO with normative algorithm steps for permission checking in the Local Network Access check algorithm - Add "allowed to use" check to verify the "local-network-access" policy-controlled feature is allowed before checking permission state - Add anchor definition for HTML spec's "associated Document" term This ensures that documents must be allowed to use the feature by Permissions Policy before local network access requests can proceed, addressing the concern raised in issue #37 about requiring explicit Permissions Policy delegation.
1 parent 3def5d2 commit 6ad374d

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

index.bs

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ url: https://websockets.spec.whatwg.org/#concept-websocket-connection-obtain; ty
3636
spec: WEBSOCKET; urlPrefix: https://websockets.spec.whatwg.org/
3737
type: abstract-op;
3838
text: WebSocket opening handshake; url: #websocket-opening-handshake
39+
spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/webappapis.html
40+
type: dfn; for: global object
41+
text: associated Document; url: #concept-document-window
3942
</pre>
4043

4144
<pre class="biblio">
@@ -650,14 +653,37 @@ What follows is a sketch of a potential solution:
650653
3. Set |error|'s [=response/IP address space=] property to
651654
|connection|'s [=connection/IP address space=].
652655

653-
4. TODO: Permission check is sketched out below, wording is still vague
654-
1. If the initiating origin has been granted the local
655-
network access permission, return null.
656-
2. If the initiating origin has been denied the local network
657-
access permission, return |error|.
658-
3. Otherwise, prompt the user:
659-
1. If the user grants permission, return null.
660-
2. If the user denies the permission, return |error|.
656+
4. If |request|'s [=request/client=] is null, then return
657+
|error|.
658+
659+
5. Let |settingsObject| be |request|'s [=request/client=].
660+
661+
6. Let |global| be |settingsObject|'s [=environment settings
662+
object/global object=].
663+
664+
7. Let |document| be |global|'s [=global object/associated
665+
Document=].
666+
667+
8. If |document| is null, then return |error|.
668+
669+
9. If |document| is not [=allowed to use=]
670+
"local-network-access", then return |error|.
671+
672+
10. Let |permissionState| be the result of [=getting the current
673+
permission state=] given "local-network-access" and |global|.
674+
675+
11. If |permissionState| is [=permission/denied=], then return
676+
|error|.
677+
678+
12. If |permissionState| is [=permission/granted=], then return
679+
null.
680+
681+
13. [=Prompt the user to choose=] whether to grant
682+
"local-network-access" for |global|:
683+
684+
1. If the user grants permission, then return null.
685+
686+
2. If the user denies permission, then return |error|.
661687
1. Return null.
662688

663689
1. The [$fetch$] algorithm is amended to add 2 new steps right after request’s

0 commit comments

Comments
 (0)