From de55c4c81dfb6cf13e5e2ae24ae88c9be4f5b598 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Fri, 22 Nov 2024 00:19:29 -0300 Subject: [PATCH 1/2] feat: add cveId support CVE-ID: CVE-2024-12345 --- commit-stream.js | 2 ++ test.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/commit-stream.js b/commit-stream.js index 2bf713a..0f034b0 100644 --- a/commit-stream.js +++ b/commit-stream.js @@ -46,6 +46,8 @@ export default function commitStream (ghUser, ghProject) { commit.reviewers = [] } commit.reviewers.push({ name: m[1], email: m[2] }) + } else if ((m = line.match(/\bCVE-ID:\s+(CVE-\d{4}-\d{5})\b/)) !== null) { + commit.cveId = m[1]; } else if ((m = line.match(/^\s+PR(?:[- ]?URL)?:?\s*(.+)\s*$/) || line.match(/\(#(\d+)\)$/)) !== null) { commit.prUrl = m[1] if ( diff --git a/test.js b/test.js index f88ec4f..bfbf60f 100644 --- a/test.js +++ b/test.js @@ -224,3 +224,26 @@ test('current commit log with ghUser and ghRepo passed', function (t) { }, 'got correct pr url for green-button merge') }) }) + +test('cve id', function (t) { + gitToList(t, 'git log', 'rvagg', 'commit-stream', function (err, list) { + t.error(err, 'no error') + + t.ok(list && list.length > 1, 'got a list') + + t.deepEqual(list[list.length - 18], { + sha: 'b23208796d7e3fd08b36f6106aa7f027aa827137', + authors: [ + { name: 'Rich Trott', email: 'rtrott@gmail.com' } + ], + authorDate: 'Mon Oct 11 19:29:18 2021 -0700', + prUrl: 'https://github.com/rvagg/commit-stream/pull/5', + ghIssue: 5, + ghUser: 'rvagg', + ghProject: 'commit-stream', + author: { name: 'Rich Trott', email: 'rtrott@gmail.com' }, + summary: 'chore: update strip-ansi to 6.x', + cveId: '' + }, 'got correct pr url for green-button merge') + }) +}) From a32a38d45a0407e524112d111516ad9a941d4a01 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Fri, 22 Nov 2024 00:35:06 -0300 Subject: [PATCH 2/2] test: add CVE-ID test --- test.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test.js b/test.js index bfbf60f..ef05d56 100644 --- a/test.js +++ b/test.js @@ -231,19 +231,15 @@ test('cve id', function (t) { t.ok(list && list.length > 1, 'got a list') - t.deepEqual(list[list.length - 18], { - sha: 'b23208796d7e3fd08b36f6106aa7f027aa827137', + t.deepEqual(list[list.length - 30], { + sha: 'de55c4c81dfb6cf13e5e2ae24ae88c9be4f5b598', authors: [ - { name: 'Rich Trott', email: 'rtrott@gmail.com' } + { name: 'RafaelGSS', email: 'rafael.nunu@hotmail.com' } ], - authorDate: 'Mon Oct 11 19:29:18 2021 -0700', - prUrl: 'https://github.com/rvagg/commit-stream/pull/5', - ghIssue: 5, - ghUser: 'rvagg', - ghProject: 'commit-stream', - author: { name: 'Rich Trott', email: 'rtrott@gmail.com' }, - summary: 'chore: update strip-ansi to 6.x', - cveId: '' + authorDate: 'Fri Nov 22 00:19:29 2024 -0300', + author: { name: 'RafaelGSS', email: 'rafael.nunu@hotmail.com' }, + summary: 'feat: add cveId support', + cveId: 'CVE-2024-12345' }, 'got correct pr url for green-button merge') }) })