Skip to content

Commit

Permalink
(Security:toastr) Fix #147
Browse files Browse the repository at this point in the history
  • Loading branch information
Medicean committed Apr 12, 2019
1 parent d8471a1 commit 37f871b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
> 有空会补补BUG、添添新功能。
> 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT.
## `v(2.0.8)`
## `v(2.0.7.1)`

### 安全更新 (重要)

* Fix toastr 输出时未过滤导致的 xss 漏洞, 由于在 webview 中开启了 nodejs 功能, 可借此引起 RCE #147 (thx @ev0A)

> 为了防止插件中 toastr 出现类似问题, 修改了 toastr 可以输出 html 的特点,以后均不支持输出 html
### 其它

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antsword",
"version": "2.0.7",
"version": "2.0.7.1",
"description": "中国蚁剑是一款跨平台的开源网站管理工具",
"main": "app.js",
"dependencies": {
Expand Down
12 changes: 10 additions & 2 deletions static/libs/toastr/toastr.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,20 @@
}

if (map.title) {
$titleElement.append(map.title).addClass(options.titleClass);
$titleElement.append(String(map.title)
.replace(/&/g, "&")
.replace(/>/g, ">")
.replace(/</g, "&lt;")
.replace(/"/g, "&quot;")).addClass(options.titleClass);
$toastElement.append($titleElement);
}

if (map.message) {
$messageElement.append(map.message).addClass(options.messageClass);
$messageElement.append(String(map.message)
.replace(/&/g, "&amp;")
.replace(/>/g, "&gt;")
.replace(/</g, "&lt;")
.replace(/"/g, "&quot;")).addClass(options.messageClass);
$toastElement.append($messageElement);
}

Expand Down

0 comments on commit 37f871b

Please sign in to comment.