google / mesop

Rapidly build AI apps in Python
https://google.github.io/mesop/
Apache License 2.0
5.62k stars 267 forks source link

Trusted Type Policy CSP Error even though not using web components #1100

Closed richard-to closed 1 day ago

richard-to commented 1 day ago

I'm using 0.12.8. Then I run a hello world app, but weirdly getting CSP errors in the console. I've heard some other people mentioning this as well.

import mesop as me 

@me.page()
def app():
  me.text("Hello World")
Running server on: http://localhost:32123
 * Serving Flask app 'mesop.server.server'
 * Debug mode: off

⚠️  Content Security Policy Error  ⚠️
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Directive:   trusted-types
Blocked URL: trusted-types-policy
App path:    /

ℹ️  If this is coming from your web component,
   update your security policy like this:

@me.page(
  security_policy=me.SecurityPolicy(
    dangerously_disable_trusted_types=True
  )
)

For more info:
https://google.github.io/mesop/web-components/troubleshooting/
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
wwwillchen commented 1 day ago

I did a fresh install of 0.12.8 but I can't reproduce this.

Could you paste in the CSP errors you're getting in the console? I'm wondering if it's being caused by a Chrome/browser extension (I think I saw this before). If you open in an incognito window / without any extensions, can you still repro this?

richard-to commented 1 day ago

Ah yeah. You're right. It's being caused by a Chrome extension. That's good to know. Multiple people have mentioned this recently up and down stream.