@architect/inventory 2.1.2 → 2.1.3

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
@@ -2,6 +2,14 @@
2
2
 
3
3
  ---
4
4
 
5
+ ## [2.1.3] 2021-11-04
6
+
7
+ ### Fixed
8
+
9
+ - Hardened runtime validation by ensuring non-string values will fail gracefully
10
+
11
+ ---
12
+
5
13
  ## [2.1.2] 2021-10-28
6
14
 
7
15
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@architect/inventory",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -39,5 +39,12 @@
39
39
  },
40
40
  "eslintConfig": {
41
41
  "extends": "@architect/eslint-config"
42
+ },
43
+ "nyc": {
44
+ "check-coverage": true,
45
+ "branches": 100,
46
+ "lines": 100,
47
+ "functions": 100,
48
+ "statements": 100
42
49
  }
43
50
  }
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- [<img src="https://s3-us-west-2.amazonaws.com/arc.codes/architect-logo-500b@2x.png" width=500>](https://www.npmjs.com/package/@architect/inventory)
1
+ [<img src="https://assets.arc.codes/architect-logo-500b@2x.png" width=500>](https://www.npmjs.com/package/@architect/inventory)
2
2
 
3
3
  ## [`@architect/inventory`](https://www.npmjs.com/package/@architect/inventory)
4
4
 
@@ -1,3 +1,4 @@
1
+ let is = require('../../../lib/is')
1
2
  let { aliases, runtimes, runtimeList } = require('lambda-runtimes')
2
3
 
3
4
  // Runtime interpolater
@@ -18,5 +19,9 @@ module.exports = function getRuntime (config) {
18
19
  config.runtimeAlias = runtime
19
20
  }
20
21
  }
22
+ else if (is.defined(runtime)) {
23
+ // Someone did something funky like specify a number or bool, so coerce and let it fail validation
24
+ config.runtime = `${config.runtime}`
25
+ }
21
26
  return config
22
27
  }
@@ -17,9 +17,9 @@ module.exports = function configValidator (params, inventory, errors) {
17
17
  errors.push(invalidMemoryMsg(`${globalMemory} MB (@aws)`))
18
18
  }
19
19
  // Runtime
20
- if (globalRuntime &&
21
- !allRuntimes.includes(globalRuntime) &&
22
- !aliases[globalRuntime]) {
20
+ if ((globalRuntime && !is.string(globalRuntime)) ||
21
+ (globalRuntime && !allRuntimes.includes(globalRuntime) &&
22
+ !aliases[globalRuntime] && !aliases[globalRuntime.toLowerCase()])) {
23
23
  errors.push(`Invalid project-level runtime: ${globalRuntime}`)
24
24
  }
25
25
  // Timeout