Skip to content

Commit 744fea2

Browse files
committed
Add pagination for CVE fetch from github
1 parent 35136d1 commit 744fea2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/upgrade/cve.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,19 @@ async function retrieveVulnerabilityData(
110110
}
111111
const octokit = new Octokit();
112112

113-
const response = await octokit.securityAdvisories.listGlobalAdvisories({
114-
ecosystem: "maven",
115-
affects: deps.map((p) => `${p.name}@${p.version}`),
116-
direction: "asc",
117-
sort: "published",
118-
per_page: 100,
119-
});
113+
// Use paginate to fetch all pages of results
114+
const allAdvisories = await octokit.paginate(
115+
octokit.securityAdvisories.listGlobalAdvisories,
116+
{
117+
ecosystem: "maven",
118+
affects: deps.map((p) => `${p.name}@${p.version}`),
119+
direction: "asc",
120+
sort: "published",
121+
per_page: 100,
122+
}
123+
);
120124

121-
const allCves: CVE[] = response.data
125+
const allCves: CVE[] = allAdvisories
122126
.filter(
123127
(c) =>
124128
!c.withdrawn_at?.trim() &&

0 commit comments

Comments
 (0)