File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export default function commitStream (ghUser, ghProject) {
4646 commit . reviewers = [ ]
4747 }
4848 commit . reviewers . push ( { name : m [ 1 ] , email : m [ 2 ] } )
49- } else if ( ( m = line . match ( / \b C V E - I D : \s + ( C V E - \d { 4 } - \d { 5 } ) \b / ) ) !== null ) {
49+ } else if ( ( m = line . match ( / \b C V E - I D : \s + ( C V E - \d { 4 } - \d { 4 , } ) \b / ) ) !== null ) {
5050 commit . cveId = m [ 1 ] ;
5151 } else if ( ( m = line . match ( / ^ \s + P R (?: [ - ] ? U R L ) ? : ? \s * ( .+ ) \s * $ / ) || line . match ( / \( # ( \d + ) \) $ / ) ) !== null ) {
5252 commit . prUrl = m [ 1 ]
Original file line number Diff line number Diff line change @@ -252,3 +252,27 @@ test('cve id', function (t) {
252252 } , 'got correct pr url for green-button merge' )
253253 } )
254254} )
255+
256+ test ( 'cve id with 4 or more sequence digits' , function ( t ) {
257+ const log = ( cveId ) => [
258+ 'commit 0000000000000000000000000000000000000000' ,
259+ 'Author: RafaelGSS <rafael.nunu@hotmail.com>' ,
260+ 'Date: Fri Nov 22 00:19:29 2024 -0300' ,
261+ '' ,
262+ ' deps: fix vulnerability' ,
263+ '' ,
264+ ` CVE-ID: ${ cveId } `
265+ ]
266+ const ids = [ 'CVE-2026-9358' , 'CVE-2024-12345' , 'CVE-2017-1000117' ]
267+ const stream = commitStream ( )
268+ const commits = [ ]
269+ stream . on ( 'data' , ( commit ) => commits . push ( commit ) )
270+ stream . on ( 'end' , ( ) => {
271+ t . deepEqual ( commits . map ( ( c ) => c . cveId ) , ids )
272+ t . end ( )
273+ } )
274+ for ( const id of ids ) {
275+ for ( const line of log ( id ) ) stream . write ( line )
276+ }
277+ stream . end ( )
278+ } )
You can’t perform that action at this time.
0 commit comments