Clipboard API blocked

my recent challenge: ICP default frontend (lit-html) somehow blocked the Clipboard API

everytime i try to copy a text into user’s clipboard, it says Permission Policy Violation

i’m using the deprecated document.exec(‘copy’) for now

if u know how to unblock, pls tell me

You can edit permission policy and security policy settings via .ic-assets.json file, in your project folder, this will fix your issue.

me personally using this lib

if it not work
you can try add this to .ic-assets.json

"Permissions-Policy": "... clipboard-read=(), clipboard-write=(), ..."

Agree with @h1teshtr1path1 answer, it’s a CSP conflict that you can resolve by adapting your security rules to allow copying to clipboard. I guess you inherited a stronger policy - defined by HTTP headers - with a recent update of your frontend canister.

The fact that is deprecated is unlikely the root cause of the issue.

Just sharing if interesting, this is e.g. the newer Web API to copy text to clipboard:

await navigator.clipboard.writeText(value);

MDN docs.