Skip to content

fix: potential XSS vulnerabilities#7923

Merged
xhofe merged 6 commits intoAlistGo:mainfrom
hshpy:fix3
Mar 15, 2025
Merged

fix: potential XSS vulnerabilities#7923
xhofe merged 6 commits intoAlistGo:mainfrom
hshpy:fix3

Conversation

@hshpy
Copy link
Copy Markdown
Contributor

@hshpy hshpy commented Feb 1, 2025

readme.md文件有XSS注入风险,恶意文件可能由拥有上传权限用户上传,用户网盘app无意转存或挂载非自己网盘驱动引入(alist,共享群,分享链接等)。
预览页面markdown with word wrap,html,url open也存在。

@KirCute
Copy link
Copy Markdown
Contributor

KirCute commented Feb 16, 2025

Front-end part: AlistGo/alist-web#255

@xhofe xhofe merged commit c82e632 into AlistGo:main Mar 15, 2025
12 checks passed
@hshpy hshpy deleted the fix3 branch March 16, 2025 02:31
@j2rong4cn
Copy link
Copy Markdown
Contributor

可以参考一下cryptLink函数 以支持所有驱动

@hshpy
Copy link
Copy Markdown
Contributor Author

hshpy commented Mar 16, 2025

可以参考一下cryptLink函数 以支持所有驱动

跟驱动没关系,预览里设置的文本类型都由alist走本地代理返回,readme.md文件默认是隐藏自动加载比其它类型危险优先处理,其它文本类型前端的代码功能了解不多只能等大佬改了。

@j2rong4cn
Copy link
Copy Markdown
Contributor

文本类型都由alist走本地代理返回

我知道,但mega、crypt驱动返回的link只有RangeReadCloser,但现在这个PR没处理RangeReadCloser。我可以改,但现在身边没电脑

@hshpy
Copy link
Copy Markdown
Contributor Author

hshpy commented Mar 16, 2025

文本类型都由alist走本地代理返回

我知道,但mega、crypt驱动返回的link只有RangeReadCloser,但现在这个PR没处理RangeReadCloser。我可以改,但现在身边没电脑

理解了,我没用过这几个驱动,看了下RangeReadCloser确实没用到link.url。

long2005a1 added a commit to long2005a1/Long-Cloud that referenced this pull request Mar 16, 2025
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8168 可能是这个 fix 引入的么?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果把“过滤ReadMe 文件中的脚本”关了问题就解决了,那就说明确实是这个PR带来的问题,但这也不是一个bug,只是你这个使用场景就需要把这个选项关掉

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以针对 webdav 的 get 请求单独处理么?

if utils.Ext(file.GetName()) == "md" && setting.GetBool(conf.FilterReadMeScripts) {

这样有些粗暴了?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果把“过滤ReadMe 文件中的脚本”关了问题就解决了,那就说明确实是这个PR带来的问题,但这也不是一个bug,只是你这个使用场景就需要把这个选项关掉

建议大佬还是兼容下 WebDAV,否则对于很多依赖 WebDAV 同步 markdown 笔记的用户来说功能都不可用了。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议大佬还是兼容下 WebDAV,否则对于很多依赖 WebDAV 同步 markdown 笔记的用户来说功能都不可用了。

要不你等这个 PR 的作者给你回复?这个 PR 是解决安全问题的,我也不是很清楚在 webdav 场景下存不存在这种安全问题,我感觉是存在的,如果这样的话从这个 PR 要解决的问题的角度出发没道理单独给 webdav 开绿灯。我意思你就先把“过滤 ReadMe 文件中的脚本”关掉这样用着

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webdev获取的文件又不会渲染,如果我要下载的是md文件那他就不应该变成html文件

Copy link
Copy Markdown
Contributor Author

@hshpy hshpy Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webdev获取的文件又不会渲染,如果我要下载的是md文件那他就不应该变成html文件

这个issue用的软件就是支持webdav协议和实时预览的md编辑器。如果是将webdav挂到本地会不会也有影响?
新版本已经把webdav协议下过滤脚本去掉了,这pr如果影响到使用可以到设置把过滤关掉就跟以前版本一样(关的话最好把自动渲染readme也关掉)

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

Successfully merging this pull request may close these issues.

6 participants