Skip to content

Updating to react-dropdown-select v5 seems to break CSP #364

Description

@JanneSalo

In v4, I could do this in order to get inline style tags added by react-dropdown-select to work with my Content Security Policy:

import createCache from '@emotion/cache'
import { CacheProvider } from '@emotion/react'
import { createRoot } from 'react-dom/client'

const emotionCache = createCache({
  key: 'myApp',
  nonce: window.NONCE_ID, // CSP nonce generated elsewhere
})

const router = /** ... */
const container = document.getElementById('app')
const root = createRoot(container)
root.render(
  <CacheProvider value={emotionCache}>
    <RouterProvider router={router} />
  </CacheProvider>
)

Since v5 dropped emotion support, this is no longer possible. Is there an alternative way to allow the module's inline style tags in CSP using a nonce or is this a regression?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions