Skip to content

Commit

Permalink
FIX Add SS-2023-001 style security commits.
Browse files Browse the repository at this point in the history
Noticed this in passing while reviewing another change
  • Loading branch information
GuySartorelli committed Sep 18, 2023
1 parent cc33e6d commit acf2b11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/Model/Changelog/ChangelogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,14 @@ public function getShortHash()
*/
public function getSecurityCVE()
{
// New CVE style identifiers
if (preg_match('/^\[(?<cve>CVE-(\d){4}-(\d){4,})\]/i', $this->getRawMessage(), $matches)) {
// New CVE style identifiers (e.g. CVE-2023-32302)
if (preg_match('/^\[(?<cve>(CVE-(\d){4}-(\d){4,}))\]/i', $this->getRawMessage(), $matches)) {
return strtolower($matches['cve']);
}
// Non-CVE style identifiers (e.g. SS-2023-001)
if (preg_match('/^\[(?<ss>(SS-(\d){4}-(\d){3}))\]/i', $this->getRawMessage(), $matches)) {
return strtolower($matches['ss']);
}
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Model/Changelog/ChangelogItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ public function messageProvider()
[
'[SS-2047-123] Lower doubt with cow coverage',
'[SS-2047-123] Lower doubt with cow coverage',
'Other changes'
'Security'
],
[
'[ss-2047-123] Lower doubt with cow coverage',
'[ss-2047-123] Lower doubt with cow coverage',
'Other changes'
'Security'
],
['[SS-2047-123]: Logins now use passwords', '[SS-2047-123]: Logins now use passwords', 'Other changes'],
['[ss-2047-123]: Logins now use passwords', '[ss-2047-123]: Logins now use passwords', 'Other changes'],
['[SS-2047-123]: Logins now use passwords', '[SS-2047-123]: Logins now use passwords', 'Security'],
['[ss-2047-123]: Logins now use passwords', '[ss-2047-123]: Logins now use passwords', 'Security'],
['[CVE-1234-56789]: Fix something serious', 'Fix something serious', 'Security'],
['[CVE-1234-12345] Remove admin login backdoor', 'Remove admin login backdoor', 'Security'],
['[cve-1234-123456] added admin login backdoor', 'added admin login backdoor', 'Security'],
Expand Down

0 comments on commit acf2b11

Please sign in to comment.