Skip to content

Commit 2f2cd43

Browse files
authored
Merge pull request #1481 from danger/fb/cve-octokit-rest-mitigation
chore: Upgrade @octokit/rest for CVE patch - no-ESM mitigation patch - Fixes #1479
2 parents 88a524b + e13bed1 commit 2f2cd43

File tree

9 files changed

+3563
-4691
lines changed

9 files changed

+3563
-4691
lines changed

Diff for: .github/workflows/CI.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v4
1111
- uses: actions/setup-node@v4
1212
with:
13-
node-version: "18"
13+
node-version: "20"
1414

1515
# Get local dependencies & test
1616
- run: yarn install

Diff for: .vscode/settings.json

+46-4
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,55 @@
1414
"editor.formatOnSave": true,
1515
"debug.node.autoAttach": "on",
1616
"cSpell.words": [
17-
"APIPR",
18-
"BITBUCKETSERVER",
19-
"Chainsmoker",
20-
"Commenter",
2117
"accum",
18+
"ahobson",
19+
"alexandermendes",
2220
"apipr",
21+
"APIPR",
2322
"ashfurrow",
2423
"autogenerated",
2524
"bdotdub",
2625
"bitbucket",
26+
"BITBUCKETSERVER",
2727
"bitrise",
2828
"buildkite",
2929
"caffodian",
30+
"Chainsmoker",
31+
"CIAPI",
3032
"codefresh",
3133
"codemagic",
3234
"codeship",
35+
"Commenter",
3336
"commit's",
3437
"dangerfile",
3538
"dangerfiles",
39+
"davidhouweling",
3640
"deletable",
41+
"denieler",
3742
"dfalling",
43+
"doniyor",
3844
"dsljson",
3945
"dtslint",
4046
"eigen",
4147
"fbartho",
4248
"filepaths",
49+
"Fixtured",
50+
"fsevents",
4351
"gantman",
52+
"GHSA",
4453
"gitdata",
4554
"globbed",
55+
"gzaripov",
56+
"hellocore",
57+
"hmcc",
58+
"hmschreiner",
4659
"hongrich",
60+
"Honza",
4761
"hyperlinker",
62+
"igorbek",
4863
"ints",
4964
"isobject",
65+
"jamiebuilds",
5066
"jira",
5167
"jsondsl",
5268
"jsonpointer",
@@ -55,27 +71,53 @@
5571
"kwonoj",
5672
"lockfile",
5773
"macklinu",
74+
"mapvalues",
75+
"meloni",
76+
"melvinvermeer",
77+
"memfs",
5878
"micromatch",
5979
"mifi",
6080
"mlabrum",
81+
"Moni",
6182
"nevercode",
6283
"octokit",
84+
"offrey",
85+
"openapi",
86+
"orta",
87+
"ozzieorca",
88+
"pagelen",
6389
"patriksimek",
6490
"peterjgrainger",
91+
"pgoudreau",
92+
"pinkasey",
6593
"prdsl",
94+
"prepush",
6695
"repo",
6796
"repo's",
97+
"rogerluan",
98+
"Rouby",
99+
"rwvf",
100+
"rzgry",
68101
"samdmarshall",
102+
"shyim",
103+
"sogame",
104+
"Therox",
69105
"tldr",
70106
"tooling",
71107
"tooling's",
72108
"transpiler",
109+
"transpiling",
73110
"tychota",
74111
"type'd",
112+
"typedoc",
113+
"typescriptify",
114+
"unfernandito",
75115
"urkle",
116+
"valscion",
76117
"vendored",
77118
"voca",
78119
"vsts",
120+
"wardpeet",
79121
"webhook",
80122
"wizardishungry"
81123
]

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
<!-- Your comment below this -->
1818

19+
- Update `@octokit/rest` to prevent transitive CVEs - Fixes [#1479](https://github.com/danger/danger-js/issues/1479) [@fbartho]
1920
- Clean up dead discussion link - Fixes [#1467](https://github.com/danger/danger-js/issues/1467) [@fbartho]
2021

2122
<!-- Your comment above this -->

Diff for: appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Test against this version of Node.js
22
environment:
3-
nodejs_version: "18"
3+
nodejs_version: "20"
44

55
# Install scripts. (runs after repo cloning)
66
install:

Diff for: package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"type": "git",
7979
"url": "git+https://github.com/danger/danger-js.git"
8080
},
81-
"packageManager": "[email protected].19",
81+
"packageManager": "[email protected].22",
8282
"keywords": [
8383
"danger",
8484
"ci"
@@ -135,7 +135,7 @@
135135
"nock": "^13.2.0",
136136
"pkg": "^5.8.1",
137137
"prettier": "^2.5.1",
138-
"release-it": "^13.5.2",
138+
"release-it": "^18.1.2",
139139
"shx": "^0.3.4",
140140
"ts-jest": "^28.0.0",
141141
"ts-node": "^10.9.2",
@@ -145,7 +145,7 @@
145145
},
146146
"dependencies": {
147147
"@gitbeaker/rest": "^38.0.0",
148-
"@octokit/rest": "^18.12.0",
148+
"@octokit/rest": "^20.1.2",
149149
"async-retry": "1.2.3",
150150
"chalk": "^2.3.0",
151151
"commander": "^2.18.0",
@@ -165,7 +165,7 @@
165165
"lodash.keys": "^4.0.8",
166166
"lodash.mapvalues": "^4.6.0",
167167
"lodash.memoize": "^4.1.2",
168-
"memfs-or-file-map-to-github-branch": "^1.2.1",
168+
"memfs-or-file-map-to-github-branch": "^1.3.0",
169169
"micromatch": "^4.0.4",
170170
"node-cleanup": "^2.1.2",
171171
"node-fetch": "^2.6.7",

Diff for: source/api/fetch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function retryableFetch(
4545
{
4646
retries: retries,
4747
onRetry: (error, attempt) => {
48-
warn(error.message)
48+
warn((error as any)?.message)
4949
warn(`Retry ${attempt} of ${retries}.`)
5050
},
5151
}

Diff for: source/platforms/github/GitHubUtils.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ export const createOrUpdatePR =
171171
}
172172

173173
d("Creating a branch")
174-
await filepathContentsMapToUpdateGitHubBranch(api, fileMap, branchSettings)
174+
// temporary hack because typescript thinks we're using two different definitions of Octokit?
175+
const tmpHackApi = api as any as Parameters<typeof filepathContentsMapToUpdateGitHubBranch>[0]
176+
await filepathContentsMapToUpdateGitHubBranch(tmpHackApi, fileMap, branchSettings)
175177

176178
d("Getting open PRs")
177179
const prs = await api.pulls.list({ repo, owner, state: "open" })

Diff for: source/runner/runners/utils/_tests/_transpiler.test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ describe("babelify", () => {
9595
const dangerfile = `import { a } from 'lodash';
9696
a();`
9797

98-
const existsSyncMock = fs.existsSync as jest.Mock
9998
const actualFs = jest.requireActual("fs") as typeof fs
99+
const existsSyncMock = fs.existsSync as jest.Mock
100+
const statSyncMock = fs.statSync as jest.Mock
100101
existsSyncMock.mockImplementation((path) => path === "/a/b/babel.config.js" || actualFs.existsSync(path))
102+
statSyncMock.mockImplementation((path) =>
103+
// browserslist gets called by babelify, and browserslist checks for all imported things to see if they're directories
104+
path === "/a/b/babel.config.js" ? { isDirectory: () => false } : actualFs.statSync(path)
105+
)
101106
jest.mock(
102107
"/a/b/babel.config.js",
103108
() => {

0 commit comments

Comments
 (0)