#1017: ClipboardChange event API
Discussions
Log in to see TAG-private discussions.
Discussed
Dec 16, 2024 (See Github)
Dan: reprises discussion from breakout C
Amy: there is info in the explainer about privacy levels and also user activation...
Jeffrey: the fact that several applications like excel and google docs - want to show "you have this data to paste" - they can probably do that without access to the data. It's important that remote desktops be implementable on the web... but they can probably do this and also meet privacy goals... Also google and apple have been active on the spec...
Hadley: that's good news
Sarven: is there any doucmentation on the same category of things being a threat? As far as I know, clipboard is managed in the RAM. You can always come with a use case... Should there be any room for having any access in the RAM?
Martin: I agree with Dan. Lots of things go across my clipboard, and if arbitrary webistes could access that, it's terrible. there are constraints around the use of hte clipboard: it has to be foregrounded, etc. But I think there is a difficult question about what it means to be an agent, to be your computer. A random website acting as your computer is difficult for me, that it might be ok for this website to do that and not others. And remote desktop apps need that capability. When we were talking about access to ubikeys and local passkeys, the remote computer is now wanting to access local computer things to act as your computer and I'm not comfortalbe with that. Just saying "that's ok, this is an important use case" hides the difficulty here. Sarven's point about accessing RAM is putting a sharp point on it. I think no website should have that capability.
Dan: It feels like that capability, like ubikeys and access to local drives etc, would/could be appropriate if you've installed and given permission to a complete client environment. But it may be that it shouldn't be something the web should do. Maybe it's too powerful for the web.
When it comes to pasting, and access to the clipboard, I still don't see... it doesn't degrade the experience that much to have to wait for the user to press paste before the contents of the clipboard are pasted into the other environment. It's not like you're denying access, just making sure the user really intends to transfer that thing to the other side. Otherwise it could be passwords, urls, any kind of ino in your clipboard.
jeffrey: The thing the user does to tell a site they want to paste may not be ctrl+v, it may be a button. We could use a user gesture, but we can't be sure the user did it all... Also, there are persistent differences between UAs on this question. Chrome and chromium browsers are not going to stop chasing remote desktop as a use case, and firefox and safari and not going to pursue the use case in the same way. So the design question: how to make an api that doesn't create a bad user experience across browsers? I think the clipboard API has been designed successfully. The read event ... If we arrange it so the same code works in all places and degrades gracefully, we will have succeeded. Might be able to say "do this only in IWAs". I don't think chromium will accept "just don't do it"
Torgo: Thinking through the UX, the user might still have access to a paste menu option. It may be that the remote desktop environment has to lead the user through a permission request experience in order to get them to request that permission.
Jeffrey: that permission is what some browsers don't think is a good idea.
torgo: This is why I installed hte clear clipboard thing on MacOS to clear my clipboard regularly. I don't want the text in my clipboard to be siphoned off for other use cases. I don't agree that the current API has been designed well. We are lowering the bar re keeping users safe on the web.
Jeffrey: They present 2 use cases in their explainer. Pressing paste in a remote app doesn't always work, which I think is a bug in the system and not a web issue. 2: they want to know the types of data in the clipboard. I think that's much safer to expose than the data.
I suspect mozilla and safari will be happy with that. probably still worth gating behind a permission, but doesn't seem dangerous like the content seems dangerous.
Tess: interesting weird custom types could be fingerprinting info. But if it's limited to ... distinct from arbirary media points -- not as bad.
Not obvious to the user that granting permission to occasionally paste means this web app will learn that I have photoshop installed on this computer. Or whatever domain specific software I have installed.
Torgo: probably less directly harmful, but there might be some harms just knowing the types.
Tess: domain specific application with a proprietary format
Matthew: For background info, the file-type fingerprinting issue came up earlier in the year with respect to Delayed Clipboard Rendering
Martin: You can send messages across domains, since it's easy to put content on the clipboard. It's another channel that shouldn't exist.
Torgo: I don't know if we'll resolve this here
Martin: "Chromium wants it, therefore we need to accept that, no matter the moral value" -- I'm tired of this.
Torgo: I don't know that I agree with that wording, but in some cases we have pushed back hard on APIs that have been presented to us for design review such as the managed device API... we said we can't stop anyone from writing something in their own software, but this shouldn't be part of the web platform.
"XYZ company, you have business requirements to do a particular thing, but that doesn't mean we have to put it in the web platform. You can deal with it iwith your own business partners." It was intended for IT people to manage and monitor what the users in their enterprise were doing, and it's not something we need to do on the web.
the tension between not reviewing things that we think are not a good idea and trying to push back on things to make a difference where we can - harm reduction
...Let's defer this to next year. No consensus now.
Jeffrey: I can draft a comment for the private-discussion thread.
Discussed
Dec 16, 2024 (See Github)
Dan: we had a discussion a while ago about clipboard access and whether tehre should be any requirement to use the paste command in order for the web app to gain access to the contents of the clipboard. I still feel that is the case. A web app should never have access to the clipboard unless I explicitly tell it I want to paste something from my clipboard. It seemed like.. this issue still has not been resolved.. there are people who feel there are circumstances even without a permission grant that a web app should be able to access clipboard contents. I guess because some applications can access it without user interaction. Which is also frightening.
Amy: what's the use case? why is immediate clipboard sync useful?
Matthew: it can be a convenience...
Tristan: I use cross-device copy-paste all the time...
Amy: I'm skimming the user stories and they don't feel like user stories. Also worried about information leak.
Dan: I don't expect that the remote client automatically syncs the contents of my clipboard. What I expect is that I copy something from Mac and go to the Windows environment, press paste, and and then at that point content is pasted. There's an action required. I'm concerned with anything that's polling or event based. I can understand if you've gone through the situation of having installed a remote desktop client but in the web context I'm extremely worried about it because it can provide access to information that you wouldn't expect. It's an attack vector.
Matthew: I see those concerns. You can do the magic cross device copy paste, just make it a pull rather than a push, on a user action. Also concern about things that involve events or polling - implication I'm seeing you can already do it with polling.
Dan: that's exactly where my mind has gone
Amy: It does say "It provides an efficient alternative to polling the clipboard for changes."
Dan: let's discuss async and then decide what to do at the plenary.
Discussed
Jan 6, 2025 (See Github)
Matthew: we discussed last year and Jeffrey made a comment - the concern we had was that we don't need as much as info as they say they do to do the things they want to do... Jeffrey's proposed comment puts that across... As a separate issue it shouldn't be possible to do this by polling and that's a bug.
we ask Jeffrey to leave his comment
Dan: let's discuss at the plenary.
Comment by @jyasskin Jan 8, 2025 (See Github)
The TAG is concerned about revealing the clipboard to sites without the browser knowing that its user meant to do so. The gesture requirement described in https://github.com/w3c/clipboard-apis/issues/225 seems like the minimum bar, but it would be ideal to find a way for the browser to know that the user actually saw a "paste" button or used their native paste keyboard shortcut, as the TAG previously requested in https://github.com/w3c/clipboard-apis/issues/52#issuecomment-875709431.
However, it doesn't seem like your use cases actually need to reveal the clipboard's contents to the website in real time. We see 2 use cases in your explainer:
-
In a remote desktop client, the user asks the remote side to paste, and it reads from its own clipboard instead of the user's local clipboard. This seems like a bug in the remote desktop software, that it's not forwarding clipboard requests to the client. We're not experts in the APIs needed to implement this, but there's a proposal at https://github.com/w3c/editing/issues/417 and https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/DelayedClipboard/DelayedClipboardRenderingExplainer.md to allow web pages to only generate clipboard data when it's requested by the paster, and it seems like the remote desktop host could use the same native mechanisms to forward clipboard requests to the web browser.
-
The user wants to be able to pick which of several clipboard formats to paste, and the website needs to know what formats are available in order to give the user those choices, and this UI needs to be ready as soon as the user looks for it, not after the user clicks it. Notably, this only requires the list of formats that are on the clipboard, not the data in any of those formats. This is still a privacy risk, especially if the user copies data from a specialized application that provides an unusual kind of clipboard data. But it's not the same level of risk as exposing every password the user copies. Could you explore providing just the list of available clipboard types in the
clipboardchange
event, and not the full clipboard contents?
Are there any other use cases that actually need the clipboard contents in real time? The TAG is likely to remain skeptical that the tradeoff is worth it, but we should know what the tradeoff is.
Comment by @ragoulik Jan 13, 2025 (See Github)
Wanted to provide my initial thoughts/clarifications after reading the above mentioned two points especially this concern:
Could you explore providing just the list of available clipboard types in the clipboardchange event, and not the full clipboard contents?
I think there is misunderstanding that clipboardchange event would provide full clipboard contents when it is fired.
As mentioned in the explainer in 5.3):
Therefore, the only way to read clipboard contents within a clipboardchange event handler would be using the Async Clipboard APIs. Note that the clipboardchange event would still be a ClipboardEvent but the clipboardData attribute would be set to a null object.
So, when there is a change to clipboard, the clipboardchange event would be fired without any clipboard contents.
The web developers/apps will continue to use the already existing ways of reading clipboard which are subjected to the existing clipboard permissions that are needed to read the clipboard.
The clipboardchange event itself will need the "clipboard-read" permission to be granted on the page for it to be fired(but clipboard contents are not available when this event is fired).
@jyasskin does this help in clarifying the concerns?
Comment by @jyasskin Jan 13, 2025 (See Github)
We'd missed that statement in the explainer, but your example code does read the full clipboard contents in the event handler. Could you show how this event helps to achieve the use cases you're pursuing without doing that?
Comment by @garykac Jan 15, 2025 (See Github)
The TAG is concerned about revealing the clipboard to sites without the browser knowing that its user meant to do so. The gesture requirement described in w3c/clipboard-apis#225 seems like the minimum bar, [...]
User intent is why this can be protected by an actual permission, which requires explicit user consent. A permission + gesture can be useful if (a) you don't believe the user intended to grant permission and (b) it doesn't interfere with valid use scenarios. However, with clipboard it does prevent scenarios related to background clipboard synchronization (e.g., with remote access applications).
- In a remote desktop client, the user asks the remote side to paste, and it reads from its own clipboard instead of the user's local clipboard. This seems like a bug in the remote desktop software, that it's not forwarding clipboard requests to the client.
Forwarding the clipboard requests from the remote host to the client would add a network round-trip to each clipboard operation. And when the local client received the request, what would it do? It would need to read the clipboard (without a gesture) to satisfy the request and send the data to the remote host.
A better user experience is to read the local clipboard when it changes and send it to the remote host. Which requires a way to know when the clipboard has changed (we currently rely on heuristics like checking the clipboard when focus is regained), and a way to access the clipboard (read and write) outside of user gestures.
In both cases, for this scenario there needs to be a way to read from the clipboard without a gesture. This is why we have a permission for this implemented in Chrome.
But, because of platform and UX differences, it's fair for different user agents to choose different ways to control access to these APIs. In Chrome, there is a permission so that access can be granted without requiring a gesture. Firefox and Safari don't use the permission and rely on gestures (plus, IIUC, heuristics to identify the correct kind of gestures). We tried to write the async clipboard spec in a way that gave implementations flexibility in this regard.
We're not experts in the APIs needed to implement this, but there's a proposal at Seeking feedback on delayed clipboard rendering proposal w3c/editing#417 and https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/DelayedClipboard/DelayedClipboardRenderingExplainer.md to allow web pages to only generate clipboard data when it's requested by the paster, and it seems like the remote desktop host could use the same native mechanisms to forward clipboard requests to the web browser.
The delayed clipboard rendering discussion is unrelated. It's merely a performance optimization so that expensive clipboard content is not generated unless it is going to be immediately used. Even if the remote (native) host made use of whatever native mechanisms exist for this, that doesn't help the local (browser) client access the clipboard when a request is triggered by the remote host.
Discussed
Jan 20, 2025 (See Github)
Matthew: we're saying "privacy beats convenience for remote desktop users" and they say the other way around. They want it to be a seamless experience. We want the user to have control over their clipboard.
Dan: And I still feel that we need to look outside of the remote desktop case.. There is no argument that in that case, the seamless experience is greatly aided by their approach. However, the issue is with other developers who might seek to take advantage of this ... "bad actors" - but there is also a grey area... Everyone thinks their application is the only application people are using and everyone thinks their application is the most important application.
Matthew: I like Dan's approach - let's look at the general abuse cases, and how they could be mitigated. This will allow us to make some progress. We're not against remote access apps, but we are for preventing abuse cases. I think this will help us reach some common ground on where the risks are.
Xiaocheng: who's responsibility is it to raise abuse scenarios?
Dan: we have prompted scenarios ...
Matthew: they don't have an explicit privacy & security section in their explainer, but they do talk about privacy & security in each sub-proposal section, and aligning with existing clipboard API. Our concern is partly with the existing clipboard API too. We have some abuse scenarios from recent minutes here. Has W3C done any thread modelling on this?
Hadley: something about remote desktop as a use cases .. crosses out of the browser and out of the web... not just looking at the browser but looking at what is going on in another OS, which crosses out of the privacy/security boundaries of the web... We keep having this problem when we look at remote desktop use cases. I don't see a way around it.
<blockquote> First a bit of context: The TAG feels the whole clipboard API platform is more permissive regarding permission than it should be. And we have fed back and will feed back on this in more detail in due course. Also to be clear, we understand that your position is that this is required for the remote desktop scenario in order to allow for seamless clipboard access. The concern we have is about abuse of this API in *other* scenarios. Remember that web users will also be using other web applications, visiting other web sites, and will be subject to the same risks and attacks as any other web users.For example: user receives a text message from a scammer purporting to be their bank; user clicks on the URL in the text message; now they are interacting with a web page that looks like their bank but it's really a scam web site; the web site uses this API to scrape any info off the user's clipboard.
...
</blockquote>we agree to come back to this after Matthew looks through our minutes for other abuse cases we've talked about
Discussed
Jan 27, 2025 (See Github)
For example: user receives a text message from a scammer purporting to be from a trustworthy site; user clicks on the URL in the text message; now they are interacting with a web page that looks benign but it's really a scam web site; The web site convinces the user to paste something into the page; the web site shows the permission prompt, which of course the user accepts, and thereafter it's able to scrape any info off the user's clipboard any time it gets focus.
We also think the remote desktop use cases would work fine if it only works on paste, and without the clipboardchange event, websites don't know when a copy happens and so are incentivized to only read the clipboard on paste. With clipboardchange, they get a new incentive to be incompatible with Firefox and Safari, which isn't good for the Web. Before endorsing clipboardchange, we'd like to see an explanation for why that won't happen.
</blockquote>Jeffrey: not convinced by the abuse case... They are going to update their explainer to describe why clipboard change is useful even if you don't assume chrome's UI model for clipboard... And I think the TAG is fine with the Firefox & Safari UI model.
discussion of an explicit permission grant
Jeffrey: in Firefox the browser pops up somehting and in Chrome there is an explicit permission grant.
Dan: leaves comment
Comment by @torgo Jan 27, 2025 (See Github)
Hi @garykac –
First a bit of context: The TAG feels the whole clipboard API is more permissive regarding permission than it should be. Also to be clear, we understand that your position is that this is required for the remote desktop scenario in order to allow for seamless clipboard access. The concern we have is about abuse of this API in other scenarios. Remember that web users will also be using other web applications, visiting other web sites, and will be subject to the same risks and attacks as any other web users.
For example: user receives a text message from a scammer purporting to be from a trustworthy site; user clicks on the URL in the text message; now they are interacting with a web page that looks benign but it's really a scam web site; The web site convinces the user to paste something into the page; the web site shows the permission prompt, which of course the user accepts, and thereafter it's able to scrape any info off the user's clipboard any time it gets focus.
We also think the remote desktop use cases would work fine if it only works on paste, and without the clipboardchange event, websites don't know when a copy happens and so are incentivized to only read the clipboard on paste. With clipboardchange, they get a new incentive to be incompatible with Firefox and Safari, which isn't good for the Web. Before endorsing clipboardchange, we'd like to see an explanation for why that won't happen.
Discussed
Feb 3, 2025 (See Github)
Matthew: [summarises the discussion thus far] We are awaiting feedback, but they haven't yet. At the plenary, we can ask Jeffrey if he knows anything procedurally.
Xiaocheng: if the current API is to permissive, what is our appraoch to further restrict it?
Matthew: we're still working it out. If it's an existing API which we don't expect is going away, we can file a bug on it. In this case, the intention is for this new stuff to replace the old, so we are concentrating on making the new stuff safe for users. Once that's been implemented, we would advocate for removing the old and unsafe stuff. But we haven't had a concensus fro mthe TAG on this.
Xiaocheng Hu: I see. So, another decade's work.
Hadley: Yes
Matthew: let's check this again at the plenary.
Discussed
Feb 10, 2025 (See Github)
Jeffrey: still waiting on an expainer update... But that shouldn't block the TAG from leaving a comment...
we agree ball is in their court
Comment by @ragoulik Mar 12, 2025 (See Github)
ClipboardChange event explainer has been updated with an approach that makes implementation possible not only on Chromium but also on Firefox and Safari for the use cases outlined. ('Introduction ' and 'Permissions and Interop' sections) Explainer is also updated to emphasize that security and privacy concerns are considered by calling out clearly that event will be fired only when the page is in focus and clipboard data is not exposed.
Discussed
Mar 17, 2025 (See Github)
Jeffrey: Dan Clark and I are too close to the contributors. DanA has concerns.
Yves: It'd be good to know how the browsers ???
Jeffrey: {explains background on the issue / explainer} This matches what iOS does. Gets a toast sayin the webapp is being sketchy but with ??? you don't get it. Firefox / Safari are okay with this design. Am excited about this because it'd enough to get remote desktop apps. Because it opens the use case for Firefox/Safari.. we could push Chromium to not read the clipboard all the time.
Sarven: Piecing together from a couple meetings. I thought the concern was that there's a permission being given to the app, that once they have it, there's no way the user can know when to revoke that permission. So the app/site has continuous access to the clipboard. Also, the original issue was giving read access to RAM. What precautions are being taken? Or reasoning? There's a lot the user is asked about accessing hardware; can understand the argument that this falls into that category, and the UX can be designed so the user is aware, and you have the right to revoke it. Is just making that a possibility, good in itself? Laptops have an indicator that the camera is on, via a light. Clipboard: is there such an indicator? Understand the concerns that are raised. What steps are taken to ensure that it's safe and/or even if the user is tricked into granting permission, they have ways of backtracking.
Jeffrey: This particular API doesn't fix any of those problems. Chromium permission model for clipboard allows persistent access. I think there are ways for Chromium to indicate those but they haven't implemented the mitigations. So that bad state is still ther.e The reason I'm still excited about this is that it give a route to fixing that. Doesn't make it better or worse. Firefox/Safari have shipped nearly the same API without a problem, without a permission. This allows the use cases for Chromium where they have permission quality ... We should scope our review to this API and what it enables. Chromium has the status quo but this at least gives a process to improving that situation.
Matthew: For context, we've discussed this before and realised that the status quo isn't acceptable but this is narrow in scope. Why do we need to know the types on the clipboard on copy as opposed to paste.
Jeffrey: 1) there is a lot of spreadsheed apps, they give you the kind of things you can paste (value, formula, format etc.) And in order to what to enable you have to know what's on the clipboard. Need to know that when the user enables, before pasting.
Matthew: Native apps similar?
Jeffrey: This is why iOS allows type-x without warning.
Matthew: re Sarven's permissions, you said iOS popup with toast before permission, if you give permission, how long is the permission?
Jeffrey: Safari, or at least iOS doesn't. So what they did was to pop up a toast. The UI they have for the async API, thwn then wesite asks to read the clipboard, one item with paste item in it. If you trigger it with keyboard, it'd be under the mouse - bad accessibility / UI problems - kind of works.
Matthew: This clearly is an improvement over the status quo but some TAG's understanding is that the status quo is already really bad. Ack improving things for the future. What can we do if we say go for this? e.g., To encourage Chromium's model to change.
Jeffrey: https://github.com/w3ctag/design-principles/pull/563 . Directly relevant. Don't improve API unless mitigating problems. A path toward fixing them. I don't know how we can push Chrome to fix this. The sketch I had in mind is all three browsers ship this API. Remote desktop app that uses this could use all three. Maybe we take a page from iOS to show the toast. Right now it shows if you pasted in current sessions - that can be louder. Don't know for sure which way would have traction.
Dan: UI more aggressive to push those measures if we have this as off ramp.
Matthew: We don't say how their UI should be. I guess once we okay this as TAG, then need to push on it hoping that it changes.
Jeffrey: We can file Chromium bugs for example. Suggest a UI along the lines of x,y,z.
Matthew: We also talked about this is writing to the clipboard. That seems also free for all. Perhaps of the lesser of the two evils.
Jeffrey: We could toast on write. Same paste surfaces do this. They warn you like finger-pasting can do bad stuff for you. Windows-command ought to be doing that. We should be telling people the stuff in the clipboard is not necessarily safe.
Matthew: Good example of annoying but not malicious and user doesn't know until pasting.
Jeffrey: They immitate recaptcha.
Jeffrey: So what's next? Sarven's been most skeptical on the call, so what do you think?
Sarven: You mentioned Dan A has a concern, so from my end, I'd like to catch up. Everything said has been sensible, but I don't understand it well enough.
Dan: I can write a draft proposal. Can write a summary based on today in the private brainstorming.
Matthew: Yes, and, like Sarven want to check out the edges. Mention the direction and also file bugs that needs to be followed up to address the root problem.
Discussed
Mar 31, 2025 (See Github)
Martin: I think the new draft is great. Let's give Torgo one more chance to review, and post tomorrow.
[General agreement]
Discussed
Mar 31, 2025 (See Github)
Matthew: no new comments on the issue... but we talked about this. ..
we move it to proposed close and we have a draft closing comment we will revisit at the plenary and hopefully close
Comment by @torgo Apr 3, 2025 (See Github)
Hi folks - we discussed in our plenary call today and agreed on this comment which has been collaborated on by the the group, with notable input from @dandclark, @martinthomson:
The TAG is happy to see the changes made to include only the clipboard data types in the event (and only the types, rather than the full clipboard contents). We believe that the use of types is sufficient to give applications the information they need to satisfy the use cases in the explainer, without the risks that involved with granting full clipboard access. The existing Chromium model of using permissions to gate full read access to the clipboard is not necessary to satisfy these use cases, and we consider it to be unsafe: it's too easy for sites to gain and to maintain full clipboard access in a way that's not always clear to users.
But we believe that the current state of this proposal does not worsen that use of permissions, and in fact offers a path towards improvement. By granting access to the data types only, some scenarios that today would require full clipboard access could now instead be implemented in an interoperable way without a problematic use of the permission model.
That said, the other protections mentioned are still important and should not be loosened. Namely, the requirements that the document have focus to receive the event and that multiple clipboard changes occurring while the document does not have focus must be coalesced to a single event with only the current state at the time the document regains focus. An additional requirement we feel is important is that the event should only be fired if the document has achieved the sticky activation state.
So we are closing this as satisfied, and we encourage further exploration of how dependence on long-lived clipboard permissions can be scaled back in an interoperable way.
OpenedNov 22, 2024
こんにちは TAG-さん!
I'm requesting an early TAG design review of ClipboardChange event API.
The clipboardchange event is fired whenever the system clipboard contents are changed. This allows web-apps like remote desktop clients to be notified and respond to changes to the system clipboard. It provides an efficient alternative to polling the clipboard for changes.
Further details:
You should also know that...
The design doc of this feature for Chromium might be useful for review. Code changes for a prototype implementation can be found here.
CAREFULLY READ AND DELETE CONTENT BELOW THIS LINE BEFORE SUBMITTING
Use links to content rather than pasting text into this issue. Issues are ephemeral and most of the material we are asking for has long term value.
Please preview the issue and check that the links work before submitting. Please make sure anyone with the link can access the document. We may refuse to review anything that is not public.
¹ An explainer must address user needs and contain examples of use. See our explanation of how to write a good explainer.
² Even for early-stage ideas, a Security and Privacy questionnaire helps us understand potential security and privacy issues and mitigations for your design, and can save us asking redundant questions. See https://www.w3.org/TR/security-privacy-questionnaire/.
³ For your own organization, you can simply state the organization's position instead of linking to it. This includes items on Mozilla standards-positions, and WebKit standards-positions. Chromium doesn't have a standards-positions repository and prefers to use comments from the teams that maintain the relevant area of their codebase.