josdejong/jsoneditor

Remove Data URLs from code

开放

#1,418 创建于 2022年2月5日

 (5 条评论) (0 个反应) (0 位负责人)JavaScript (2,078 个派生)batch import
featurehelp wanted

仓库指标

星标
 (12,263 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

In this piece of code a data URL is used:

https://github.com/josdejong/jsoneditor/blob/e69a835f721bab6824b65f3d13717a20ff7d81f7/src/js/ace/theme-jsoneditor.js#L138

This requires applications using Content Security Policy directives with full restrictions to allow data: as described here and here.

https://security.stackexchange.com/questions/94993/is-including-the-data-scheme-in-your-content-security-policy-safe discusses if data: is safe or not. One answer suggests it has never been proven to be unsafe, even though multiple articles mentions it is.

To be better safe than sorry many applications forbid data: and only allow the 'self' as the CSP source.

Would it be possible to put the SVG in an external file and instead bundle it that way? I.e. as a real URL to the .svg. It's also nice in the sense that users can actually open the SVG in the src in this repo to see what it looks like 😄

贡献者指南