Closed itDjango closed 3 years ago
吓得我
得去看看
得去看看
所以你的项目有这个问题吗? 或者你怎么解决的?
我暂时还没又发现耶,可能是因为我对这个不是特别熟悉吧。
我暂时还没又发现耶,可能是因为我对这个不是特别熟悉吧。
你在编辑器里面 输入
不会弹吗
tan'le弹了
可是我不知道咋整呀
可是我不知道咋整呀
这是比较严重的安全问题,如果你项目对安全性要求很高的话! 我也没有找到解决办法,所以问问其他人有没有好的解决方案
嗯嗯,感谢
555 试试
@hinesboy 大哥,这个怎么解决啊
这个用转义 export const unHtml = (str) => { return str ? str.replace(/[<">']/g, (a) => { return { '<': '<', '"': '"', '>': '>', "'": ''' }[a] }) : '' } -------------例子----------------- const str = "
" newStr = unHtml(str) console.log(newStr) // <p></p>刚npm安装完这插件就提示有安全漏洞了,貌似全部版本都有影响,只能自己先解决了
前端不太熟,不知道怎么办,但我在写后端时我是直接用spring的HtmlUtils做转义的。
这个用转义 export const unHtml =(str)=> { return str?str.replace(/ [<“>'] / g,(a)=> { return { '<':'<', '”':'“', '>':'>', ”'“: ''' } [a] }):'' } -------------例子----------------- const str =“
“ newStr = unHtml(str) console.log(newStr) //
</ p>
你这个方法可以解决他一边输入一边预览时xss吗? 俗称XSS自己。
前端不太熟,不知道怎么办,但我在写初步时我是直接用spring的HtmlUtils做转义的。
这个问题后台转义没用的,因为他是在输入的时候即时XSS,在输入完成后前端把数据传给后台时前端可以进行转义,后台也可以转义。 但是就是他在一边输入一边预览时,不知道怎么禁止XSS。
反正我后来是放了了这个编辑器,换了别的。因为我们对安全要求很高,XSS自己也不行。
反正我后来是放了了这个编辑器,换了别的。因为我们对安全要求很高,XSS自己也不行。
大哥,最后你换成了那个编辑器,能推荐下吗
Duplicate of #285
我暂时是选择的禁用 html 不过看 #368 好像禁用了还是有问题 不知道什么情况
I just intalled this editor, soon after...
Visiting the npm advisory website I get this:
Any updates? This is bad security practice...
反正我后来是放了了这个编辑器,换了别的。因为我们对安全要求很高,XSS自己也不行。
大哥,最后你换成了那个编辑器,能推荐下吗
I just intalled this editor, soon after...
- When I run "npm audit" i get this message:
Visiting the npm advisory website I get this:
Any updates? This is bad security practice...
So I gave up and recommend you my new one https://www.npmjs.com/package/wangeditor
any updates?
High Cross-Site Scripting
Package mavon-editor
Patched in No patch available
Dependency of mavon-editor
Path mavon-editor
More info https://npmjs.com/advisories/1169
可以考虑用xss插件进行转义
Any news regarding this variability?
<img onerror="alert(1)" src="a">
I tried pasting this in mavon-editor, seems its not accepting it. Not even allow to type it.
I think, this issue has been resolved in version 2.8.2
https://snyk.io/vuln/SNYK-JS-MAVONEDITOR-459108
check #548
would be nice to have NPM stop showing this issue!
Already mailed to npm security advisories. @jonathanpmartins you can mail them again
This issue has been fixed, see Snyk Report To eliminate the npm audit warning, close this issue.
If you have any questions, you can comment.
This issue has been fixed, see Snyk Report To eliminate the npm audit warning, close this issue.
If you have any questions, you can comment.
好像并没有解决... Doesn't seem to be resolved...
xss过滤默认不开启,如需开启,你可以在data中声明xssOptions
选项,配置xss规则,并设置props;
例子仅供参考:
<template>
<div id="editor">
<mavon-editor v-model="aaa" style="height: 100%" :xssOptions="xssOptions"></mavon-editor>
</div>
</template>
<script>
module.exports = {
name: "editor",
data() {
return {
aaa:"",
xssOptions: {
whiteList: {
img: ["src", "alt", "width", "height"],
},
stripIgnoreTagBody: true
}
};
},
computed: {},
methods: {}
};
</script>
<style>
#editor {
margin: auto;
width: 80%;
height: 580px;
}
</style>
xss过滤默认不开启,如需开启,你可以在data中声明
xssOptions
选项,配置xss规则,并设置props;例子仅供参考:
<template> <div id="editor"> <mavon-editor v-model="aaa" style="height: 100%" :xssOptions="xssOptions"></mavon-editor> </div> </template> <script> module.exports = { name: "editor", data() { return { aaa:"", xssOptions: { whiteList: { img: ["src", "alt", "width", "height"], }, stripIgnoreTagBody: true } }; }, computed: {}, methods: {} }; </script> <style> #editor { margin: auto; width: 80%; height: 580px; } </style>
谢谢解答 但是这样在编辑时看到的是转义后的字符,如果我想编辑时和预览时看到的是一样的怎么处理呢?
你可以试试用代码块包起来,应该可以到达这种效果
你可以试试用代码块包起来,应该可以到达这种效果
您可能误会我的意思了,我的意思是像github编辑器这样 输入 < > 时,看到的就是< >。 而不是
这看上去是xss开启带来的副作用,后面需要优化,当然我们也欢迎PR。