Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commit-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ 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) {
} else if ((m = line.match(/\bCVE-ID:\s+(CVE-\d{4}-\d{4,})\b/)) !== null) {
commit.cveId = m[1];
} else if ((m = line.match(/^\s+PR(?:[- ]?URL)?:?\s*(.+)\s*$/) || line.match(/\(#(\d+)\)$/)) !== null) {
commit.prUrl = m[1]
Expand Down
24 changes: 24 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,27 @@ test('cve id', function (t) {
}, 'got correct pr url for green-button merge')
})
})

test('cve id with 4 or more sequence digits', function (t) {
const log = (cveId) => [
'commit 0000000000000000000000000000000000000000',
'Author: RafaelGSS <rafael.nunu@hotmail.com>',
'Date: Fri Nov 22 00:19:29 2024 -0300',
'',
' deps: fix vulnerability',
'',
` CVE-ID: ${cveId}`
]
const ids = ['CVE-2026-9358', 'CVE-2024-12345', 'CVE-2017-1000117']
const stream = commitStream()
const commits = []
stream.on('data', (commit) => commits.push(commit))
stream.on('end', () => {
t.deepEqual(commits.map((c) => c.cveId), ids)
t.end()
})
for (const id of ids) {
for (const line of log(id)) stream.write(line)
}
stream.end()
})
Loading