ac-sanitizer 4.0.4 → 4.0.6
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/.ncurc.json +4 -0
- package/CHANGELOG.md +25 -0
- package/index.js +4 -2
- package/package.json +6 -6
- package/test/tests/base64.js +5 -1
package/.ncurc.json
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
<a name="4.0.6"></a>
|
|
2
|
+
|
|
3
|
+
## [4.0.6](https://github.com/mmpro/ac-sanitizer/compare/v4.0.5..v4.0.6) (2024-01-27 16:26:02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fix
|
|
7
|
+
|
|
8
|
+
* **App:** Package updates | MP | [7461c3f1713cbdb7a4f678b6ee98b01c4b421cbe](https://github.com/mmpro/ac-sanitizer/commit/7461c3f1713cbdb7a4f678b6ee98b01c4b421cbe)
|
|
9
|
+
Package updates
|
|
10
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
11
|
+
<a name="4.0.5"></a>
|
|
12
|
+
|
|
13
|
+
## [4.0.5](https://github.com/mmpro/ac-sanitizer/compare/v4.0.4..v4.0.5) (2023-12-10 14:34:04)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fix
|
|
17
|
+
|
|
18
|
+
* **App:** Fixed base64 enum checks | MP | [e581e9c1d1bb2cf503d1cd3cda3ff664e52dc387](https://github.com/mmpro/ac-sanitizer/commit/e581e9c1d1bb2cf503d1cd3cda3ff664e52dc387)
|
|
19
|
+
Fixed base64 enum checks
|
|
20
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
21
|
+
### Chores
|
|
22
|
+
|
|
23
|
+
* **App:** Updated packages | MP | [c343e6539772abe535743e30399de20d45e66af4](https://github.com/mmpro/ac-sanitizer/commit/c343e6539772abe535743e30399de20d45e66af4)
|
|
24
|
+
Updated packages
|
|
25
|
+
Related issues: [undefined/undefined#master](undefined/browse/master)
|
|
1
26
|
<a name="4.0.4"></a>
|
|
2
27
|
|
|
3
28
|
## [4.0.4](https://github.com/mmpro/ac-sanitizer/compare/v4.0.3..v4.0.4) (2023-09-29 09:27:21)
|
package/index.js
CHANGED
|
@@ -329,10 +329,12 @@ const sanitizer = function() {
|
|
|
329
329
|
let pad = l % 4
|
|
330
330
|
if (!validator.isBase64(_.padEnd(value, (l+pad), '='))) error = { message: fieldName + '_notABase64String' }
|
|
331
331
|
else if (field.convert) {
|
|
332
|
-
|
|
332
|
+
value = Buffer.from(value, 'base64').toString()
|
|
333
|
+
_.set(paramsToCheck, fieldName, value)
|
|
333
334
|
// the value might be a stringified object - try converting it
|
|
334
335
|
try {
|
|
335
|
-
|
|
336
|
+
value = JSON.parse(value)
|
|
337
|
+
_.set(paramsToCheck, fieldName, value)
|
|
336
338
|
}
|
|
337
339
|
catch(e) {
|
|
338
340
|
// ignore
|
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": "4.0.
|
|
7
|
+
"version": "4.0.6",
|
|
8
8
|
"homepage": "https://www.admiralcloud.com",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"ac-countrylist": "^1.0.
|
|
11
|
-
"ac-file-extensions": "^2.0.
|
|
10
|
+
"ac-countrylist": "^1.0.9",
|
|
11
|
+
"ac-file-extensions": "^2.0.8",
|
|
12
12
|
"ac-ip": "^3.1.0",
|
|
13
13
|
"chai": "^4.3.10",
|
|
14
|
-
"date-and-time": "^3.
|
|
14
|
+
"date-and-time": "^3.1.1",
|
|
15
15
|
"hashids": "^2.3.0",
|
|
16
16
|
"lodash": "^4.17.21",
|
|
17
17
|
"validator": "^13.11.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"ac-semantic-release": "^0.4.2",
|
|
21
|
-
"c8": "^
|
|
22
|
-
"eslint": "^8.
|
|
21
|
+
"c8": "^9.1.0",
|
|
22
|
+
"eslint": "^8.56.0",
|
|
23
23
|
"mocha": "^10.2.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
package/test/tests/base64.js
CHANGED
|
@@ -15,6 +15,10 @@ module.exports = {
|
|
|
15
15
|
{ name: 'Base64 app.admiralcloud.com - with padding', type: 'base64', value: 'aHR0cHM6Ly9hcHAuYWRtaXJhbGNsb3VkLmNvbQ==', convert: true, expected: 'https://app.admiralcloud.com' },
|
|
16
16
|
{ name: 'Base64 encoded object', type: 'base64', value: 'eyJ1c2VySWQiOjEyMywiY3VzdG9tZXJJZCI6MTQ2LCJyZWFzb24iOiJCZWNhdXNlIEkgY2FuIn0=', convert: true, expected: { userId: 123, customerId: 146, reason: 'Because I can' } },
|
|
17
17
|
{ name: 'Base64 encoded object', type: 'base64', value: 'eyJ1c2VySWQiOjEyMywiY3VzdG9tZXJJZCI6MTQ2LCJyZWFzbOiJCZWNhdXNlIEkgY2FuIn0=', convert: true, error: 'base64_notABase64String' },
|
|
18
|
+
{ name: 'Base64 array with enum', type: 'base64', value: 'WzAsMSw5OCw5OSwxMDBd', convert: true, expected: [0, 1, 98, 99, 100], enum: [0, 1, 98, 99, 100] },
|
|
19
|
+
{ name: 'Base64 array with enum - fail', type: 'base64', value: 'WzAsMSw5OCw5OSwxMDBd', convert: true, error: 'base64_notAnAllowedValue', enum: [200] },
|
|
20
|
+
{ name: 'Base64 string with enum', type: 'base64', value: 'bXlzdHJpbmc=', convert: true, expected: 'mystring', enum: ['mystring', 'otherstring'] },
|
|
21
|
+
{ name: 'Base64 string with enum - fail', type: 'base64', value: 'bXlzdHJpbmc=', convert: true, error: 'base64_notAnAllowedValue', enum: ['otherstring'] }
|
|
18
22
|
]
|
|
19
23
|
|
|
20
24
|
_.forEach(baseTests, (test) => {
|
|
@@ -24,7 +28,7 @@ module.exports = {
|
|
|
24
28
|
base64: _.get(test, 'value')
|
|
25
29
|
},
|
|
26
30
|
fields: [
|
|
27
|
-
{ field: 'base64', type: _.get(test, 'type'), convert: _.get(test, 'convert') }
|
|
31
|
+
{ field: 'base64', type: _.get(test, 'type'), convert: _.get(test, 'convert'), enum: _.get(test, 'enum') }
|
|
28
32
|
]
|
|
29
33
|
}
|
|
30
34
|
|