strong-error-handler 5.0.12 → 5.0.14
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/.editorconfig +11 -0
- package/.github/workflows/codeql-analysis.yml +4 -4
- package/.github/workflows/continuous-integration.yml +12 -12
- package/.github/workflows/scorecards.yml +3 -3
- package/CHANGES.md +54 -0
- package/eslint.config.mjs +21 -0
- package/lib/send-html.js +13 -3
- package/package.json +9 -7
package/.editorconfig
ADDED
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
actions: read
|
|
21
21
|
|
|
22
22
|
steps:
|
|
23
|
-
- uses: step-security/harden-runner@
|
|
23
|
+
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
24
24
|
with:
|
|
25
25
|
disable-sudo: true
|
|
26
26
|
egress-policy: block
|
|
@@ -30,16 +30,16 @@ jobs:
|
|
|
30
30
|
objects.githubusercontent.com:443
|
|
31
31
|
|
|
32
32
|
- name: Checkout repository
|
|
33
|
-
uses: actions/checkout@
|
|
33
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
34
34
|
with:
|
|
35
35
|
persist-credentials: false
|
|
36
36
|
|
|
37
37
|
- name: Initialize CodeQL
|
|
38
|
-
uses: github/codeql-action/init@
|
|
38
|
+
uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
|
|
39
39
|
with:
|
|
40
40
|
languages: javascript-typescript
|
|
41
41
|
config-file: .github/codeql/codeql-config.yml
|
|
42
42
|
|
|
43
43
|
- name: Perform CodeQL Analysis
|
|
44
|
-
uses: github/codeql-action/analyze@
|
|
44
|
+
uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
|
|
45
45
|
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
fail-fast: false
|
|
32
32
|
runs-on: ${{ matrix.os }}
|
|
33
33
|
steps:
|
|
34
|
-
- uses: step-security/harden-runner@
|
|
34
|
+
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
35
35
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
36
36
|
with:
|
|
37
37
|
disable-sudo: true
|
|
@@ -41,11 +41,11 @@ jobs:
|
|
|
41
41
|
github.com:443
|
|
42
42
|
nodejs.org:443
|
|
43
43
|
registry.npmjs.org:443
|
|
44
|
-
- uses: actions/checkout@
|
|
44
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
45
45
|
with:
|
|
46
46
|
persist-credentials: false
|
|
47
47
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
48
|
-
uses: actions/setup-node@
|
|
48
|
+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
|
49
49
|
with:
|
|
50
50
|
node-version: ${{ matrix.node-version }}
|
|
51
51
|
cache: npm
|
|
@@ -59,7 +59,7 @@ jobs:
|
|
|
59
59
|
name: Code Lint
|
|
60
60
|
runs-on: ubuntu-latest
|
|
61
61
|
steps:
|
|
62
|
-
- uses: step-security/harden-runner@
|
|
62
|
+
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
63
63
|
with:
|
|
64
64
|
disable-sudo: true
|
|
65
65
|
egress-policy: block
|
|
@@ -68,11 +68,11 @@ jobs:
|
|
|
68
68
|
github.com:443
|
|
69
69
|
nodejs.org:443
|
|
70
70
|
registry.npmjs.org:443
|
|
71
|
-
- uses: actions/checkout@
|
|
71
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
72
72
|
with:
|
|
73
73
|
persist-credentials: false
|
|
74
74
|
- name: Use Node.js 20
|
|
75
|
-
uses: actions/setup-node@
|
|
75
|
+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
|
76
76
|
with:
|
|
77
77
|
node-version: 20
|
|
78
78
|
cache: 'npm'
|
|
@@ -89,19 +89,19 @@ jobs:
|
|
|
89
89
|
runs-on: ubuntu-latest
|
|
90
90
|
if: ${{ github.event.pull_request }}
|
|
91
91
|
steps:
|
|
92
|
-
- uses: step-security/harden-runner@
|
|
92
|
+
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
93
93
|
with:
|
|
94
94
|
disable-sudo: true
|
|
95
95
|
egress-policy: block
|
|
96
96
|
allowed-endpoints: >
|
|
97
97
|
github.com:443
|
|
98
98
|
registry.npmjs.org:443
|
|
99
|
-
- uses: actions/checkout@
|
|
99
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
100
100
|
with:
|
|
101
101
|
fetch-depth: 0
|
|
102
102
|
persist-credentials: false
|
|
103
103
|
- name: Use Node.js 20
|
|
104
|
-
uses: actions/setup-node@
|
|
104
|
+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
|
105
105
|
with:
|
|
106
106
|
node-version: 20
|
|
107
107
|
cache: npm
|
|
@@ -125,18 +125,18 @@ jobs:
|
|
|
125
125
|
name: Lockfile Lint
|
|
126
126
|
runs-on: ubuntu-latest
|
|
127
127
|
steps:
|
|
128
|
-
- uses: step-security/harden-runner@
|
|
128
|
+
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
129
129
|
with:
|
|
130
130
|
disable-sudo: true
|
|
131
131
|
egress-policy: block
|
|
132
132
|
allowed-endpoints: >
|
|
133
133
|
github.com:443
|
|
134
134
|
registry.npmjs.org:443
|
|
135
|
-
- uses: actions/checkout@
|
|
135
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
136
136
|
with:
|
|
137
137
|
persist-credentials: false
|
|
138
138
|
- name: Use Node.js 20
|
|
139
|
-
uses: actions/setup-node@
|
|
139
|
+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
|
140
140
|
with:
|
|
141
141
|
node-version: 20
|
|
142
142
|
cache: npm
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
id-token: write
|
|
33
33
|
|
|
34
34
|
steps:
|
|
35
|
-
- uses: step-security/harden-runner@
|
|
35
|
+
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
36
36
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
37
37
|
with:
|
|
38
38
|
disable-sudo: true
|
|
@@ -47,7 +47,7 @@ jobs:
|
|
|
47
47
|
rekor.sigstore.dev:443
|
|
48
48
|
tuf-repo-cdn.sigstore.dev:443
|
|
49
49
|
www.bestpractices.dev:443
|
|
50
|
-
- uses: actions/checkout@
|
|
50
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
51
51
|
with:
|
|
52
52
|
persist-credentials: false
|
|
53
53
|
|
|
@@ -73,6 +73,6 @@ jobs:
|
|
|
73
73
|
retention-days: 90
|
|
74
74
|
|
|
75
75
|
# Upload the results to GitHub's code scanning dashboard.
|
|
76
|
-
- uses: github/codeql-action/upload-sarif@
|
|
76
|
+
- uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
|
|
77
77
|
with:
|
|
78
78
|
sarif_file: results.sarif
|
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
2024-12-04, Version 5.0.14
|
|
2
|
+
==========================
|
|
3
|
+
|
|
4
|
+
* chore: update github/codeql-action action to v3.27.6 (renovate[bot])
|
|
5
|
+
|
|
6
|
+
* chore: lock file maintenance (renovate[bot])
|
|
7
|
+
|
|
8
|
+
* chore: update dependency eslint to ^9.16.0 (renovate[bot])
|
|
9
|
+
|
|
10
|
+
* chore: update github/codeql-action action to v3.27.5 (renovate[bot])
|
|
11
|
+
|
|
12
|
+
* chore: update commitlint monorepo to ^19.6.0 (renovate[bot])
|
|
13
|
+
|
|
14
|
+
* chore: update step-security/harden-runner action to v2.10.2 (renovate[bot])
|
|
15
|
+
|
|
16
|
+
* chore: update dependency eslint to ^9.15.0 (renovate[bot])
|
|
17
|
+
|
|
18
|
+
* chore: update dependency @eslint/eslintrc to ^3.2.0 (renovate[bot])
|
|
19
|
+
|
|
20
|
+
* chore: update dependency eslint to v9 (Rifa Achrinza)
|
|
21
|
+
|
|
22
|
+
* chore: update github/codeql-action action to v3.27.4 (renovate[bot])
|
|
23
|
+
|
|
24
|
+
* chore: update github/codeql-action action to v3.27.3 (renovate[bot])
|
|
25
|
+
|
|
26
|
+
* chore: update github/codeql-action action to v3.27.2 (renovate[bot])
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
2024-11-11, Version 5.0.13
|
|
30
|
+
==========================
|
|
31
|
+
|
|
32
|
+
* chore: lock file maintenance (renovate[bot])
|
|
33
|
+
|
|
34
|
+
* chore: update github/codeql-action action to v3.27.1 (renovate[bot])
|
|
35
|
+
|
|
36
|
+
* chore: update dependency mocha to ^10.8.2 (renovate[bot])
|
|
37
|
+
|
|
38
|
+
* chore: update dependency mocha to ^10.8.1 (renovate[bot])
|
|
39
|
+
|
|
40
|
+
* chore: update actions/setup-node action to v4.1.0 (renovate[bot])
|
|
41
|
+
|
|
42
|
+
* chore: update actions/checkout action to v4.2.2 (renovate[bot])
|
|
43
|
+
|
|
44
|
+
* fix(html): avoid rendering [Object object] for undefined values (KalleV)
|
|
45
|
+
|
|
46
|
+
* chore: update dependency chai to ^5.1.2 (renovate[bot])
|
|
47
|
+
|
|
48
|
+
* chore: update github/codeql-action action to v3.27.0 (renovate[bot])
|
|
49
|
+
|
|
50
|
+
* chore: update dependency http-status to ^1.8.1 (renovate[bot])
|
|
51
|
+
|
|
52
|
+
* chore: update github/codeql-action action to v3.26.13 (renovate[bot])
|
|
53
|
+
|
|
54
|
+
|
|
1
55
|
2024-10-10, Version 5.0.12
|
|
2
56
|
==========================
|
|
3
57
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright LoopBack contributors 2024.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import {FlatCompat} from '@eslint/eslintrc';
|
|
4
|
+
const compat = new FlatCompat({
|
|
5
|
+
baseDirectory: import.meta.dirname,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
...compat.extends('loopback'),
|
|
10
|
+
{
|
|
11
|
+
languageOptions: {
|
|
12
|
+
ecmaVersion: 'latest',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.js'],
|
|
17
|
+
languageOptions: {
|
|
18
|
+
sourceType: 'commonjs',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
];
|
package/lib/send-html.js
CHANGED
|
@@ -16,6 +16,8 @@ const compiledTemplates = {
|
|
|
16
16
|
|
|
17
17
|
module.exports = sendHtml;
|
|
18
18
|
|
|
19
|
+
const STANDARD_PROPS = ['name', 'statusCode', 'message', 'stack'];
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* Sends HTML response to the client.
|
|
21
23
|
*
|
|
@@ -24,7 +26,16 @@ module.exports = sendHtml;
|
|
|
24
26
|
* @param {Object} options - The options object.
|
|
25
27
|
*/
|
|
26
28
|
function sendHtml(res, data, options) {
|
|
27
|
-
|
|
29
|
+
// Filter out properties with undefined / null values and keep standard properties
|
|
30
|
+
const filteredData = Object.keys(data).reduce((obj, key) => {
|
|
31
|
+
if (data[key] || STANDARD_PROPS.includes(key)) {
|
|
32
|
+
obj[key] = data[key];
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
35
|
+
}, {});
|
|
36
|
+
|
|
37
|
+
const toRender = {options, data: filteredData};
|
|
38
|
+
|
|
28
39
|
// TODO: ability to call non-default template functions from options
|
|
29
40
|
const body = compiledTemplates.default(toRender);
|
|
30
41
|
sendResponse(res, body);
|
|
@@ -50,8 +61,7 @@ handlebars.registerHelper('partial', partial);
|
|
|
50
61
|
* @returns {string} - The result of the Handlebars template.
|
|
51
62
|
*/
|
|
52
63
|
function standardProps(prop, options) {
|
|
53
|
-
|
|
54
|
-
if (standardProps.indexOf(prop) === -1) {
|
|
64
|
+
if (STANDARD_PROPS.indexOf(prop) === -1) {
|
|
55
65
|
return options.fn(this);
|
|
56
66
|
}
|
|
57
67
|
return options.inverse(this);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "strong-error-handler",
|
|
3
3
|
"description": "Error handler for use in development and production environments.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "5.0.
|
|
5
|
+
"version": "5.0.14",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=16"
|
|
8
8
|
},
|
|
@@ -21,20 +21,22 @@
|
|
|
21
21
|
"debug": "^4.3.7",
|
|
22
22
|
"fast-safe-stringify": "^2.1.1",
|
|
23
23
|
"handlebars": "^4.7.8",
|
|
24
|
-
"http-status": "^1.
|
|
24
|
+
"http-status": "^1.8.1",
|
|
25
25
|
"js2xmlparser": "^5.0.0",
|
|
26
26
|
"strong-globalize": "^6.0.6"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@commitlint/cli": "^19.
|
|
30
|
-
"@commitlint/config-conventional": "^19.
|
|
29
|
+
"@commitlint/cli": "^19.6.0",
|
|
30
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
31
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
31
32
|
"@types/express": "^4.17.21",
|
|
32
|
-
"chai": "^5.1.
|
|
33
|
-
"eslint": "^
|
|
33
|
+
"chai": "^5.1.2",
|
|
34
|
+
"eslint": "^9.16.0",
|
|
34
35
|
"eslint-config-loopback": "^13.1.0",
|
|
36
|
+
"eslint-plugin-mocha": "^10.5.0",
|
|
35
37
|
"express": "^4.21.1",
|
|
36
38
|
"lockfile-lint": "^4.14.0",
|
|
37
|
-
"mocha": "^10.
|
|
39
|
+
"mocha": "^10.8.2",
|
|
38
40
|
"supertest": "^7.0.0"
|
|
39
41
|
},
|
|
40
42
|
"browser": {
|