tkserver 1.7.23 → 1.7.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +3 -0
  2. package/mongo.js +3 -0
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -40,6 +40,7 @@ const {
40
40
  getConfig,
41
41
  getConfigForAdmin,
42
42
  validate,
43
+ validateClientFields,
43
44
  checkCommentOwnership,
44
45
  isValidEmail
45
46
  } = require('twikoo-func/utils')
@@ -91,6 +92,8 @@ module.exports = async (request, response) => {
91
92
  let res = {}
92
93
  try {
93
94
  protect(request)
95
+ // 统一校验客户端字段类型,防止查询操作符对象注入数据库查询条件
96
+ validateClientFields(event)
94
97
  // 判断客户端是否自带 accessToken,须在 anonymousSignIn 回填身份之前
95
98
  hasClientToken = !!(request.body && request.body.accessToken)
96
99
  accessToken = anonymousSignIn(request)
package/mongo.js CHANGED
@@ -37,6 +37,7 @@ const {
37
37
  getConfig,
38
38
  getConfigForAdmin,
39
39
  validate,
40
+ validateClientFields,
40
41
  checkCommentOwnership
41
42
  } = require('twikoo-func/utils')
42
43
  const {
@@ -86,6 +87,8 @@ module.exports = async (request, response) => {
86
87
  let res = {}
87
88
  try {
88
89
  protect(request)
90
+ // 统一校验客户端字段类型,防止查询操作符对象注入数据库查询条件
91
+ validateClientFields(event)
89
92
  // 判断客户端是否自带 accessToken,须在 anonymousSignIn 回填身份之前
90
93
  hasClientToken = !!(request.body && request.body.accessToken)
91
94
  accessToken = anonymousSignIn(request)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tkserver",
3
- "version": "1.7.23",
3
+ "version": "1.7.24",
4
4
  "description": "A simple comment system.",
5
5
  "keywords": [
6
6
  "twikoo",
@@ -31,7 +31,7 @@
31
31
  "get-user-ip": "^1.0.1",
32
32
  "lokijs": "^1.5.12",
33
33
  "mongodb": "^6.3.0",
34
- "twikoo-func": "1.7.23",
34
+ "twikoo-func": "1.7.24",
35
35
  "uuid": "^8.3.2"
36
36
  }
37
37
  }