Skip to content

Commit

Permalink
fix: making XSS adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
andrezarzur committed Sep 6, 2024
1 parent d875275 commit 663446f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ class Renderer extends EventEmitter<RendererEvents> {
const div = document.createElement('div')
const shadow = div.attachShadow({ mode: 'open' })

const nonce = this.options.nonce;
const cspNonce = this.options.cspNonce && typeof this.options.cspNonce === 'string' ? this.options.cspNonce.replace(/"/g, '') : '';

shadow.innerHTML = `
<style ${nonce ? `nonce="${nonce}"` : ''}>
<style${cspNonce ? ` nonce="${cspNonce}"` : ''}>
:host {
user-select: none;
min-width: 1px;
Expand Down
2 changes: 1 addition & 1 deletion src/wavesurfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export type WaveSurferOptions = {
/** Playback "backend" to use, defaults to MediaElement */
backend?: 'WebAudio' | 'MediaElement'
/** Nonce for CSP if necessary */
nonce?: string
cspNonce?: string
}

const defaultOptions = {
Expand Down

0 comments on commit 663446f

Please sign in to comment.