Compare commits

...

4 Commits

Author SHA1 Message Date
chenjiahan
167e99cef8 docs: fix 2022-02-14 10:51:15 +08:00
chenjiahan
b9035d69f0 docs(changelog): 2.12.44 2022-02-14 10:51:01 +08:00
chenjiahan
4585bebc3d chore: release 2.12.44 2022-02-14 10:46:54 +08:00
neverland
ee44892869
fix(utils): isEmail ReDoS (#10295) 2022-02-14 10:44:38 +08:00
5 changed files with 21 additions and 4 deletions

View File

@ -16,6 +16,14 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details
### [v2.12.44](https://github.com/youzan/vant/compare/v2.12.43...v2.12.44)
`2022-02-14`
**Bug Fixes**
- utils: isEmail ReDoS [#10295](https://github.com/youzan/vant/issues/10295)
### [v2.12.43](https://github.com/youzan/vant/compare/v2.12.39...v2.12.43)
`2022-02-10`

View File

@ -18,10 +18,18 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
- Vant 2 版本已经不再主动迭代新 Feature如果你仍在使用 Vue 2 & Vant 2建议尽快进行升级。
- 考虑到仍然有较多用户在使用 Vue 2我们会对 Vant 2 中影响面较大的 Bug 进行修复,也接受来自社区的 Pull Request欢迎贡献代码 ^\_^
- 考虑到仍然有较多用户在使用 Vue 2我们会对 Vant 2 中影响面较大的 Bug 进行修复,也接受来自社区的 Pull Request欢迎贡献代码~
## 更新内容
### [v2.12.44](https://github.com/youzan/vant/compare/v2.12.43...v2.12.44)
`2022-02-14`
**Bug Fixes**
- Sku: 修复 Email 正则表达式导致的潜在安全问题 [#10295](https://github.com/youzan/vant/issues/10295)
### [v2.12.43](https://github.com/youzan/vant/compare/v2.12.39...v2.12.43)
`2022-02-10`

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "2.12.43",
"version": "2.12.44",
"description": "Mobile UI Components built on Vue",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -77,6 +77,7 @@ test('raf', async () => {
test('isEmail', () => {
expect(isEmail('abc@gmail.com')).toBeTruthy();
expect(isEmail(' abc@gmail.com ')).toBeTruthy();
expect(isEmail('abc@@gmail.com')).toBeFalsy();
expect(isEmail('@gmail.com')).toBeFalsy();
expect(isEmail('abc@')).toBeFalsy();

View File

@ -1,5 +1,5 @@
/* eslint-disable */
export function isEmail(value: string): boolean {
const reg = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
return reg.test(value);
const reg = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/;
return reg.test(value.trim());
}