ac-sanitizer 3.9.7 → 3.9.8

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ <a name="3.9.8"></a>
2
+
3
+ ## [3.9.8](https://github.com/mmpro/ac-sanitizer/compare/v3.9.7..v3.9.8) (2021-11-27 13:26:51)
4
+
5
+
6
+ ### Bug Fix
7
+
8
+ * **App:** Package updates | MP | [fa9229b239f26f4e95097b0924c2811f64473639](https://github.com/mmpro/ac-sanitizer/commit/fa9229b239f26f4e95097b0924c2811f64473639)
9
+ Package updates, incl ac-fileExetnsion 2 (minor code change)
10
+ ### Documentation
11
+
12
+ * **App:** Minor documentation updates | MP | [d3c407c5502b5b8f7bc6479c65afa87567c26ddf](https://github.com/mmpro/ac-sanitizer/commit/d3c407c5502b5b8f7bc6479c65afa87567c26ddf)
13
+ Minor documentation updates for requirements with conditions. Added FQDN to README
1
14
  <a name="3.9.7"></a>
2
15
 
3
16
  ## [3.9.7](https://github.com/mmpro/ac-sanitizer/compare/v3.9.6..v3.9.7) (2021-10-09 17:33:05)
package/README.md CHANGED
@@ -46,13 +46,15 @@ Parameter | Type | Remarks
46
46
  --- | --- | --- |
47
47
  field | string | Name of the field
48
48
  type | string | Type of the field to sanitize, see below for available values
49
- required | [boolean|string] | Set to true if required or set a path to a param (if that param is set, this value is required)
49
+ required | [boolean OR string] | Set to true if required or set a path[^1] to a param (if that param is set, this value is required)
50
50
  enum | [array|string] | Optional list of allowed values. You can a string placeholder for certain standard lists (see below)
51
51
  adminLevel | [integer] | Optional adminLevel required for this field
52
52
  omitFields | [boolean] | If adminLevel is set and you do not have the proper adminLevel the sanitizer will just omit the field (and not return an error) if omitFields is true
53
53
  convert | [boolean|string] | Some types can be automatically converted (e.g. base64 to string)
54
54
  valueType | [string] | Use it to sanitize values of an array by defining the allowed type here
55
55
 
56
+ [^1]: The path must be set with the parent propery as root, e.g. the actual field is settings.video.width, in property video the condition is then just "width" not the full path.
57
+
56
58
  ### ENUM lists
57
59
  The following enum lists are available using a string placeholder
58
60
 
@@ -72,6 +74,7 @@ boolean | |
72
74
  cidr | | Check CIDR, see example
73
75
  integer \| boolean | | Value can be an integer OR a boolean
74
76
  date | dateFormat | Date or date time, support various date formats (e.g. DD.MM.YYYY, DD/MM/YYYY, YYYY-MM-DD, etc) as well as a custom format defined in dateFormat.
77
+ fqdn | wildcardAllowed (bool) | Fully qualified domain names, optional with wildcard subdomain (e.g. *.admiralcloud.com)
75
78
  email | | a@b.c
76
79
  float | | 0 - 2^31
77
80
  fileExtension | |
package/index.js CHANGED
@@ -282,7 +282,7 @@ const sanitizer = function() {
282
282
  }
283
283
  else if (field.type === 'fileExtension') {
284
284
  value = _.toLower(value)
285
- if (!_.find(fileExtensions, { ext: value })) {
285
+ if (!fileExtensions.query({ ext: value })) {
286
286
  error = { message: fieldName + '_' + getTypeMapping(field.type, 'errorMessage') }
287
287
  }
288
288
  _.set(paramsToCheck, fieldName, value)
package/package.json CHANGED
@@ -4,22 +4,22 @@
4
4
  "author": "Mark Poepping (https://www.admiralcloud.com)",
5
5
  "license": "MIT",
6
6
  "repository": "admiralcloud/ac-sanitizer",
7
- "version": "3.9.7",
7
+ "version": "3.9.8",
8
8
  "homepage": "https://www.admiralcloud.com",
9
9
  "dependencies": {
10
- "ac-countrylist": "^1.0.5",
11
- "ac-file-extensions": "^1.2.1",
10
+ "ac-countrylist": "^1.0.6",
11
+ "ac-file-extensions": "^2.0.0",
12
12
  "ac-ip": "^1.3.6",
13
13
  "date-and-time": "^2.0.1",
14
- "hashids": "^2.2.8",
14
+ "hashids": "^2.2.10",
15
15
  "lodash": "^4.17.21",
16
- "validator": "^13.6.0"
16
+ "validator": "^13.7.0"
17
17
  },
18
18
  "devDependencies": {
19
- "ac-semantic-release": "^0.2.6",
20
- "eslint": "^7.32.0",
21
- "expect": "^27.2.5",
22
- "mocha": "^9.1.2",
19
+ "ac-semantic-release": "^0.2.7",
20
+ "eslint": "^8.3.0",
21
+ "expect": "^27.3.1",
22
+ "mocha": "^9.1.3",
23
23
  "nyc": "^15.1.0"
24
24
  },
25
25
  "scripts": {