Skip to content

Instantly share code, notes, and snippets.

View jmonteiro's full-sized avatar

Julio Monteiro jmonteiro

View GitHub Profile
/**
* Vite plugin to fix CSP violations caused by singular-sdk
*
* ## Problem:
* The singular-sdk package (v1.4.8), contains code that uses `new Function("return this")()` to access the global object. This pattern requires 'unsafe-eval' in the Content Security Policy, which violates our CSP restrictions.
*
* ## Root Cause:
* - singular-sdk is a webpack-bundled UMD module
* - It uses `new Function("return this")()` as a cross-environment way to get
* the global object (works in browsers, Node.js, workers, etc.)

Keybase proof

I hereby claim:

  • I am jmonteiro on github.
  • I am jmonteiro (https://keybase.io/jmonteiro) on keybase.
  • I have a public key whose fingerprint is BE05 44E7 D66A 4877 E9FF CFCC 29BB 1A55 8DC2 5762

To claim this, I am signing this object: