diff --git a/src/Model/Changelog/ChangelogItem.php b/src/Model/Changelog/ChangelogItem.php index 956aa08..ead7514 100644 --- a/src/Model/Changelog/ChangelogItem.php +++ b/src/Model/Changelog/ChangelogItem.php @@ -301,10 +301,14 @@ public function getShortHash() */ public function getSecurityCVE() { - // New CVE style identifiers - if (preg_match('/^\[(?CVE-(\d){4}-(\d){4,})\]/i', $this->getRawMessage(), $matches)) { + // New CVE style identifiers (e.g. CVE-2023-32302) + if (preg_match('/^\[(?(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-(\d){4}-(\d){3}))\]/i', $this->getRawMessage(), $matches)) { + return strtolower($matches['ss']); + } } /** diff --git a/tests/Model/Changelog/ChangelogItemTest.php b/tests/Model/Changelog/ChangelogItemTest.php index 6f13f1d..017673c 100644 --- a/tests/Model/Changelog/ChangelogItemTest.php +++ b/tests/Model/Changelog/ChangelogItemTest.php @@ -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'],