Skip to content

Commit b7a8e4e

Browse files
authored
chore: update jsonpath-plus to fix cve-2024-21534 (#54)
* chore: update jsonpath-plus to fix cve-2024-21534 * chore: update dependencies * fix: github provider for updated axios * chore: update node to v22 * feat: fast audit processor
1 parent 91aa6ea commit b7a8e4e

File tree

7 files changed

+4543
-3729
lines changed

7 files changed

+4543
-3729
lines changed

.eslintrc.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
env: {
3+
es2022: true,
4+
mocha: true,
5+
node: true
6+
},
7+
8+
parserOptions: {
9+
ecmaVersion: 2023,
10+
sourceType: 'script'
11+
},
12+
13+
rules: {
14+
indent: ['error', 4],
15+
'no-param-reassign': 'off',
16+
'class-methods-use-this': 'off',
17+
'no-underscore-dangle': 'off',
18+
19+
// Allow function declarations at the bottom of a file. They are hoisted in ES6.
20+
'no-use-before-define': ['error', { functions: false }],
21+
22+
// named funcs in stacktrace
23+
'func-names': ['error', 'as-needed'],
24+
25+
'function-call-argument-newline': ['error', 'consistent'],
26+
'function-paren-newline': ['error', 'consistent'],
27+
28+
// only set strict mode when necessary
29+
'strict': ['error', 'global'],
30+
31+
'max-len': ['error', 120, 2, {
32+
ignoreUrls: true,
33+
ignoreComments: false,
34+
ignoreRegExpLiterals: true,
35+
ignoreStrings: true,
36+
ignoreTemplateLiterals: true
37+
}]
38+
}
39+
};

.github/workflows/pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
node-version: [12.x]
10+
node-version: [22.x]
1111
steps:
1212
- uses: actions/checkout@v2
1313
- name: Setup Node.js ${{ matrix.node-version }}
@@ -22,14 +22,14 @@ jobs:
2222
continue-on-error: true
2323
strategy:
2424
matrix:
25-
node-version: [12.x]
25+
node-version: [22.x]
2626
steps:
2727
- uses: actions/checkout@v2
2828
- name: Setup Node.js ${{ matrix.node-version }}
2929
uses: actions/setup-node@v1
3030
with:
3131
node-version: ${{ matrix.node-version }}
32-
- run: npm ci && npm audit --production
32+
- run: npm ci && npm run audit-production
3333
publish:
3434
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
3535
needs: [test, audit]
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup Node.js ${{ matrix.node-version }}
4040
uses: actions/setup-node@v1
4141
with:
42-
node-version: 12
42+
node-version: 22
4343
registry-url: https://registry.npmjs.org/
4444
- run: npm ci
4545
- run: npm publish --access public

lib/github_provider.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,16 @@ class GitHubContentsApi {
6868
}
6969
}))
7070
.catch(e => this._handleResponseError(e, `get contents for ${contentPath}`))
71-
.then(resp => resp.data.content)
72-
.then(data => Buffer.from(data, 'base64').toString('utf8'));
71+
.then((resp) => {
72+
if (typeof resp.data === 'string' && !(resp.data.startsWith('{') || resp.data === '')) {
73+
return resp.data;
74+
}
75+
const jsonData = typeof resp.data === 'string' ? JSON.parse(resp.data) : resp.data;
76+
if (!jsonData || !jsonData.content) {
77+
return Promise.reject(new Error(`File not found: ${contentPath}`));
78+
}
79+
return Buffer.from(jsonData.content, 'base64').toString('utf8');
80+
});
7381
}
7482
}
7583

0 commit comments

Comments
 (0)