From 44964ad9286eb0a5891f0db93cb76c0c494023a1 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 16 Jan 2022 22:32:18 +0100 Subject: [PATCH 1/3] Remove clipboard-write permission --- index.bs | 76 +++++--------------------------------------------------- 1 file changed, 6 insertions(+), 70 deletions(-) diff --git a/index.bs b/index.bs index 04171d6..45718a3 100644 --- a/index.bs +++ b/index.bs @@ -618,11 +618,11 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; 1. Let |r| be the result of running [=check clipboard read permission=] [=in parallel=] - 1. If |r| is not "granted", then reject |p| with a "NotAllowedError" DOMException + 1. If |r| is not true, then reject |p| with a "NotAllowedError" DOMException 1. Let |data| be a copy of the [=system clipboard data=] represented as a sequence of {{ClipboardItem}}s. - + Note: As further described in [[#image-transcode]] this explicitly does not transcode images. Rather the original unmodified image data should be exposed to the website. @@ -650,7 +650,7 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; 1. Let |r| be the result of running [=check clipboard read permission=] [=in parallel=] - 1. If |r| is not "granted", then reject |p| with a "NotAllowedError" DOMException + 1. If |r| is not true, then reject |p| with a "NotAllowedError" DOMException 1. Let |data| be a copy of the [=system clipboard data=]. @@ -920,54 +920,7 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; -

Permissions API Integration

- - The [[permissions]] API provides a uniform way for websites to access - powerful features like the clipboard. It allows websites to request permissions - from users and query which permissions they have. - - For the clipboard, one permission is defined: - "clipboard-write" - - Note: Clipboard permissions currently only apply to the Async Clipboard API. - Future versions of this specification may be updated to apply this permission - to other Clipboard interactions. - - These clipboard permissions are powerful features - permission-related algorithms and types are defined as follows: - -
-
- permission descriptor type -
-
-
-			dictionary ClipboardPermissionDescriptor : PermissionDescriptor {
-				boolean allowWithoutGesture = false;
-			};
-		
-
- - There are 4 clipboard permissions: - - * { name: "clipboard-write", allowWithoutGesture: false } - * { name: "clipboard-write", allowWithoutGesture: true } - - With the following relationships: - - * { "clipboard-write" + true } is stronger than { "clipboard-write" + false } - - While user agents MUST support the {{ClipboardPermissionDescriptor}} as described - in this specification, they, of course, retain complete control over the default - settings and how (or if) they are exposed to the user. - -
- A user agent that wants to have separate user-settable write controls over the clipboard - and always require a user gesture would handle each descriptor as follows: - - * { "clipboard-write" + false } is exposed for user control - * { "clipboard-write" + true } is always denied -
+

Permission checks

Clipboard read permission

@@ -993,34 +946,17 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn;

check clipboard write permission

- 1. Let |writeWithoutGesture| be the [=permission state=] of the - { name: "clipboard-write", allowWithoutGesture: true } - permission. - - 1. If |writeWithoutGesture| is granted, then return true. - 1. Let |hasGesture| be true if the [=relevant global object=] of [=this=] has [=transient activation=], false otherwise. 1. If |hasGesture| then, - 1. Let |systemCopy| be true if the current script is running as a result of user + 1. Return true if the current script is running as a result of user interaction with a "cut" or "copy" element created by the user agent or operating system. - 1. If |systemCopy| is true, then return true. - - 1. Return the result of [=request permission to use=] the - { name: "clipboard-write", allowWithoutGesture: false } - permission. - - Note: User agents may choose to request a stronger permission that - will implicitly update this permission. - - 1. Return the result of [=request permission to use=] the - { name: "clipboard-write", allowWithoutGesture: true } - permission. + 1. Return false.
From bfdd82d7eadeefc4aedd0e1582ee6a1f0702c558 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 18 Jan 2022 02:59:41 +0100 Subject: [PATCH 2/3] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 45718a3..7decdbd 100644 --- a/index.bs +++ b/index.bs @@ -616,9 +616,9 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; 1. Run the following steps [=in parallel=]: - 1. Let |r| be the result of running [=check clipboard read permission=] [=in parallel=] + 1. Let |r| be the result of running [=check clipboard read permission=] - 1. If |r| is not true, then reject |p| with a "NotAllowedError" DOMException + 1. If |r| is not true, then reject |p| with a "NotAllowedError" {{DOMException}} 1. Let |data| be a copy of the [=system clipboard data=] represented as a sequence of {{ClipboardItem}}s. @@ -956,7 +956,7 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; interaction with a "cut" or "copy" element created by the user agent or operating system. - 1. Return false. + 1. Otherwise, return false. From eb9ae4b91dbedb467051bf5c55c703c1ddaa0de8 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 18 Jan 2022 03:00:32 +0100 Subject: [PATCH 3/3] otherwise --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 7decdbd..1f6587b 100644 --- a/index.bs +++ b/index.bs @@ -937,7 +937,7 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn; interaction with a "Paste" element created by the user agent or operating system. - 1. Return false. + 1. Otherwise, return false.