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

upload 在使用 key 定义文件名的时候没有校验文件后缀 #179

Open
bdoycn opened this issue Jul 3, 2024 · 3 comments
Open

Comments

@bdoycn
Copy link

bdoycn commented Jul 3, 2024

问题:

使用 key 定义文件名时 完全没有对后缀进行校验
可能导致存储型 XSS 漏洞

建议:

配合 midway 的 upload.whitelist 配置进行校验

问题文件

/src/modules/plugin/hooks/upload/index.ts

@cool-team-official
Copy link
Owner

@bdoycn
Copy link
Author

bdoycn commented Jul 3, 2024

midway可以配置文件白名单 https://www.midwayjs.org/docs/extensions/upload#%E4%B8%8A%E4%BC%A0%E7%99%BD%E5%90%8D%E5%8D%95

额 我就是说在设置白名单的情况下 这里没有校验
注意是使用 key 作为命名的情况下 不是 filename

@cool-team-official
Copy link
Owner

可以提交个pr 看看

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

2 participants