Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否有方式可以禁止 iframe 或是其它任何 html 标签 #1555

Closed
Noahs007 opened this issue Feb 3, 2024 · 5 comments
Closed

是否有方式可以禁止 iframe 或是其它任何 html 标签 #1555

Noahs007 opened this issue Feb 3, 2024 · 5 comments

Comments

@Noahs007
Copy link

Noahs007 commented Feb 3, 2024

你在什么场景下需要该功能?

基于 electron 类似的框架做一个本地markdown编辑器。

想尽可能提高应用安全性,防注入,想知道是否有方式可以禁止 iframe 解析,甚至说可以不用 其它任何 html 标签。

描述最优的解决方案

有没有解析规则配置之类的,禁用某些语法。例如 <iframe src="https://www.hao123.com"></iframe> 目前可以显示网页,希望这种标签直接显示文本好了。

描述候选解决方案

其他信息

@Vanessa219
Copy link
Owner

@88250

@ooyyloo
Copy link

ooyyloo commented Feb 20, 2024

@88250

有办法吗?没看懂这个什么意思。
我想在编辑框里使用白名单。

@88250
Copy link
Collaborator

88250 commented Feb 26, 2024

可以试试开关 lute.SetSanitize(true),或者覆写相关渲染器:

image

@88250 88250 closed this as completed Feb 26, 2024
@Noahs007
Copy link
Author

@88250 你好, vue 项目我这样初始化的 this.contentEditor = new Vditor("vditor", { ... }); ,请问 想调用 SetSanitize(true) 可以直接通过 this.contentEditor 调用吗 。

@Vanessa219
Copy link
Owner

覆写后设置参数即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants