Repository navigation
build(desktop): set a Content Security Policy - #25
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
app.security.cspwasnull. The webview can callsession_write, so any future script injection would be code execution. The app loads nothing from the network, so a strict policy fits:default-src 'self'; script-src 'self'; connect-src ipc: http://ipc.localhost; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; base-uri 'none'; frame-src 'none'devCspadds the Vite dev server and its HMR websocket.dangerousDisableAssetCspModification: ["style-src"]stops Tauri adding a style nonce: xterm.js creates<style>elements at runtime without a nonce, and a nonce would make'unsafe-inline'ineffective. Styles cannot run script, so scripts stay locked to'self'.Fixes #20
How you checked it
eval,blob:and external fonts: none.<style>elements and style attributes still apply.cargo build --release --features tauri/custom-protocol).